RE: [PATCH 6/6] usb: musb: Add support for ti81xx platform

2011-09-06 Thread Gupta, Ajay Kumar
Hi,
  diff --git a/drivers/usb/musb/musb_core.c
  b/drivers/usb/musb/musb_core.c index 20a2873..07f3faf 100644
  --- a/drivers/usb/musb/musb_core.c
  +++ b/drivers/usb/musb/musb_core.c
  @@ -1014,7 +1014,9 @@ static void musb_shutdown(struct
 platform_device *pdev)
  || defined(CONFIG_USB_MUSB_OMAP2PLUS)   \
  || defined(CONFIG_USB_MUSB_OMAP2PLUS_MODULE)\
  || defined(CONFIG_USB_MUSB_AM35X)   \
  -   || defined(CONFIG_USB_MUSB_AM35X_MODULE)
  +   || defined(CONFIG_USB_MUSB_AM35X_MODULE)\
  +   || defined(CONFIG_USB_MUSB_TI81XX)  \
  +   || defined(CONFIG_USB_MUSB_TI81XX_MODULE)
 
 we really need to find a better way to handle this :-(

We use to have 'fifo_mode' within 'struct musb_platform_ops' so shouldn't
It be brought back to fix this?

Thanks,
Ajay

 
  diff --git a/drivers/usb/musb/ti81xx.c b/drivers/usb/musb/ti81xx.c
 new
  file mode 100644 index 000..f95774e
  --- /dev/null
  +++ b/drivers/usb/musb/ti81xx.c
 
 I still think this should be part of am35x.c It really look like they
 are very similar.
 
 on monday I'll read the rest of the file.
 
 --
 balbi
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 6/6] usb: musb: Add support for ti81xx platform

2011-09-06 Thread Felipe Balbi
Hi,

On Tue, Sep 06, 2011 at 12:30:15PM +0530, Gupta, Ajay Kumar wrote:
   diff --git a/drivers/usb/musb/musb_core.c
   b/drivers/usb/musb/musb_core.c index 20a2873..07f3faf 100644
   --- a/drivers/usb/musb/musb_core.c
   +++ b/drivers/usb/musb/musb_core.c
   @@ -1014,7 +1014,9 @@ static void musb_shutdown(struct
  platform_device *pdev)
 || defined(CONFIG_USB_MUSB_OMAP2PLUS)   \
 || defined(CONFIG_USB_MUSB_OMAP2PLUS_MODULE)\
 || defined(CONFIG_USB_MUSB_AM35X)   \
   - || defined(CONFIG_USB_MUSB_AM35X_MODULE)
   + || defined(CONFIG_USB_MUSB_AM35X_MODULE)\
   + || defined(CONFIG_USB_MUSB_TI81XX)  \
   + || defined(CONFIG_USB_MUSB_TI81XX_MODULE)
  
  we really need to find a better way to handle this :-(
 
 We use to have 'fifo_mode' within 'struct musb_platform_ops' so shouldn't
 It be brought back to fix this?

no. I don't think that's a good idea. The best way would be for gadget
to tell us about all endpoints it will use in one go. Something like
usb_ep_request_array() (to match the gpio_request_array), with that, we
could allocate FIFO space based on how many endpoints will be used, in
fact.

But that's something for the future, for now the ifdef is the only way
:-(

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH 6/6] usb: musb: Add support for ti81xx platform

2011-09-02 Thread Felipe Balbi
Hi,

On Mon, Aug 29, 2011 at 03:16:55PM +0530, Gupta, Ajay Kumar wrote:
 I have compiled the differences in the register map between am35x and
 ti81xx and they are listed below.
 
 ===
 Register  am35x [has one musb]ti81xx [two musb 
 interface]
 ===
 REVISION  0x000x - for 
 USBSS
   0x1000 - for 
 musb0
   0x1800 - for 
 musb1
 
 ALL USBSS registers   Not present Available from offset
   0x-0x0FFC
 
 USB_CTRL_REG  0x040x1014  - for musb0
   0x1814  - for 
 musb1
 
 USB_STAT_REG  0x080x1018  - for musb0
   0x1818  - for 
 musb1
 
 USB_EMULATION_REG 0x0cNot present
 USB_AUTOREQ_REG   0x14Not present
 USB_SRP_FIX_TIME_REG  0x18Not present
 USB_TEARDOWN_REG  0x1cNot present
 
 USB_IRQ_MERGED_STATUS Present as part of  0x1020 - for musb0
   EP_INTR_x or CORE_INTR_x0x1820 - for 
 musb1
   register in am35x but
   at different offsets

 USB_IRQ_EOI   Same as above   0x1024 - for musb0
   0x1824 - for 
 musb1
 USB_IRQ_STATUS_RAW_0  Same as above   0x1028 - for musb0
   0x1828 - for 
 musb1
 USB_IRQ_STATUS_RAW_1  Same as above   0x102c - for musb0
   0x182c - for 
 musb1
 USB_IRQ_STATUS_0  Same as above   0x1030 - for musb0
   0x1830 - for 
 musb1
 USB_IRQ_STATUS_1  Same as above   0x1034 - for musb0
   0x1834 - for 
 musb1
 USB_IRQ_ENABLE_SET_0  Same as above   0x1038 - for musb0
   0x1838 - for 
 musb1
 USB_IRQ_ENABLE_SET_1  Same as above   0x103c - for musb0
   0x183c - for 
 musb1
 USB_IRQ_ENABLE_CLR_0  Same as above   0x1040 - for musb0
   0x1840 - for 
 musb1
 USB_IRQ_ENABLE_CLR_1  Same as above   0x1044 - for musb0
   0x1844 - for 
 musb1
 
 EP_INTR_SRC_REG   0x20Present as part 
 of 
   USB_IRQ_x 
 register in
   ti81xx but at 
 different
   offsets
 EP_INTR_SRC_SET_REG   0x24Same as above
 EP_INTR_SRC_CLEAR_REG 0x28Same as above
 EP_INTR_MASK_REG  0x2cSame as 
 above
 EP_INTR_MASK_SET_REG  0x30Same as above
 EP_INTR_MASK_CLEAR_REG0x34Same as 
 above
 EP_INTR_SRC_MASKED_REG0x38Same as 
 above
 CORE_INTR_SRC_REG 0x40Same as 
 above
 CORE _INTR_SRC_SET_REG0x44Same as 
 above
 CORE _INTR_SRC_CLEAR_REG  0x48Same as above
 CORE _INTR_MASK_REG   0x4cSame as above
 CORE _INTR_MASK_SET_REG   0x50Same as 
 above
 CORE _INTR_MASK_CLEAR_REG 0x54Same as above
 CORE _INTR_SRC_MASKED_REG 0x58Same as above
 USB_END_OF_INTR_REG   0x60Same as above
 
 CPPI4.1 DMA   
 REVISION  Not present 0x2000
 TEARDOWN FREE DESCRIPTOR  Not present 0x2004
 EMULATION CONTROL Not present 0x2008
 
 TxCh0 GLOBAL_CONFIG   0x1800  0x2800
 RxCh0 GLOBAL_CONFIG   0x1808  0x2808
 RxCh0 HOST_PKT_CFG_A  0x180c  0x280c
 

RE: [PATCH 6/6] usb: musb: Add support for ti81xx platform

2011-09-02 Thread Gupta, Ajay Kumar
Hi,
  If you compare am35x and da8x then you would find that they are
 mostly
  same and so should be merged. They both have one musb instances.
 
  Ti81xx has two musb interface and huge differences in register map as
  listed Above so ti81xx should be in a separate file.
 
  Apart from this, am35 and da8x is not yet runtime pm compatible but
  the current patches supporting ti81x is runtime pm compliant.
 
  I think da8x and am35x files should be merged in a separate patch
  once they are tested after the merge.

 Sure, let's try to merge them as soon as possible.

Ok.

 Now, about this one.
 I still think the wrapper is essentially the same, but the memory map
 is different, right ?

Yes, except that usbss related wrappers are completely new in ti81xx and
They are not present in am35x or da8xx or davinci series platforms.

 I mean, the programming model of the wrapper and
 its features are the same, correct ?

Yes.

 So, how about you abstract the
 memory map by passing the address offsets via driver_data ?

This sounds to be a cleaner way of doing this. Let me work on this and
propose something.

 The thing
 is that this is all duplicated code in a sense. Although the register
 map is different, the HW block is the same, isn't it ?
Yes.

 Just a few tweaks to support multiple musb instances.

Except that the complete new usbss wrapper.

 In that case, I'm not very keen on letting yet another very similar
 file to be added.

Let me collect all the details and discuss further on this.

 How about you add a very clean musb-dsps.c file (btw, at some point, I
 want all glue layers to have musb- prepended to them) which, for now,
 only handles this new chip, but it has memory map passed in via
 driver_data ? Then it should be very simple to convert davinci, da8xx
 and am35x to the new file.
Ok.

 
 You will probably need to revisit the other device's TRM to see what
 needs to be abstracted or flaged somehow. What is board-specific and
 what is silicon-specific and that sort of thing. But it will be a very
 nice exercise and the output will be the deletion of three very similar
 files.
Ok.

Thanks,
Ajay
 
 --
 balbi
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 6/6] usb: musb: Add support for ti81xx platform

2011-08-29 Thread Felipe Balbi
Hi,

On Mon, Aug 29, 2011 at 11:01:54AM +0530, Gupta, Ajay Kumar wrote:
   diff --git a/drivers/usb/musb/musb_core.c
   b/drivers/usb/musb/musb_core.c index 20a2873..07f3faf 100644
   --- a/drivers/usb/musb/musb_core.c
   +++ b/drivers/usb/musb/musb_core.c
   @@ -1014,7 +1014,9 @@ static void musb_shutdown(struct
  platform_device *pdev)
 || defined(CONFIG_USB_MUSB_OMAP2PLUS)   \
 || defined(CONFIG_USB_MUSB_OMAP2PLUS_MODULE)\
 || defined(CONFIG_USB_MUSB_AM35X)   \
   - || defined(CONFIG_USB_MUSB_AM35X_MODULE)
   + || defined(CONFIG_USB_MUSB_AM35X_MODULE)\
   + || defined(CONFIG_USB_MUSB_TI81XX)  \
   + || defined(CONFIG_USB_MUSB_TI81XX_MODULE)
  
  we really need to find a better way to handle this :-(
 
 How about passing the mode info from musb_config (musb-config-fifo_mode),
 same way as musb-config-fifo_cfg 

not sure... Ideally we wouldn't really need those fifo tables, but I'm
still thinking how to properly do that.

 Infact I think, we can kill musb-config-fifo_cfg and have only
 musb-config-mode as in this way all the fifo tables will be at one
 place and should help in maintenance.

The idea of musb-config-fifo_cfg was to allow boards to pass their
optimal fifo table. If a certain product, knows it will only support
mass storage, why not letting them enable only those needed endpoints in
an optimized way (with double buffering, bulk combine/split, etc).

   diff --git a/drivers/usb/musb/ti81xx.c b/drivers/usb/musb/ti81xx.c
  new
   file mode 100644 index 000..f95774e
   --- /dev/null
   +++ b/drivers/usb/musb/ti81xx.c
  
  I still think this should be part of am35x.c It really look like they
  are very similar.
 
 Wrapper registers are different but I will see on this and provide you details
 On how the merged file would look like. I am afraid that we may have to use
 Either #ifdef or cpu_is_xxx().

we can use platform_device_id to cope with the differences :-) See how
I'm using it on dwc3 driver (Greg's usb-next branch).

-- 
balbi


signature.asc
Description: Digital signature


RE: [PATCH 6/6] usb: musb: Add support for ti81xx platform

2011-08-29 Thread Gupta, Ajay Kumar
Hi,
   we really need to find a better way to handle this :-(
 
  How about passing the mode info from musb_config (musb-config-
 fifo_mode),
  same way as musb-config-fifo_cfg
 
 not sure... Ideally we wouldn't really need those fifo tables,

Yes, if all the board files provide their own fifo_cfg.

 but I'm still thinking how to properly do that.
 
  Infact I think, we can kill musb-config-fifo_cfg and have only
  musb-config-mode as in this way all the fifo tables will be at one
  place and should help in maintenance.
 
 The idea of musb-config-fifo_cfg was to allow boards to pass their
 optimal fifo table. If a certain product, knows it will only support
 mass storage, why not letting them enable only those needed endpoints
 in an optimized way (with double buffering, bulk combine/split, etc).

Ok fine, understood.

  Wrapper registers are different but I will see on this and provide
 you details
  On how the merged file would look like. I am afraid that we may have
 to use
  Either #ifdef or cpu_is_xxx().
 
 we can use platform_device_id to cope with the differences :-) See how
 I'm using it on dwc3 driver (Greg's usb-next branch).

Please refer the usb section in below TRMs.
da8x (aka. am1x) at http://www.ti.com/lit/ug/sprufw6b/sprufw6b.pdf
am35x at http://www.ti.com/lit/ug/sprugr0b/sprugr0b.pdf
ti81x at http://www.ti.com/lit/ug/sprugx8/sprugx8.pdf

I have compiled the differences in the register map between am35x and
ti81xx and they are listed below.

===
Registeram35x [has one musb]ti81xx [two musb 
interface]
===
REVISION0x000x - for 
USBSS
0x1000 - for 
musb0
0x1800 - for 
musb1

ALL USBSS registers Not present Available from offset
0x-0x0FFC

USB_CTRL_REG0x040x1014  - for musb0
0x1814  - for 
musb1

USB_STAT_REG0x080x1018  - for musb0
0x1818  - for 
musb1

USB_EMULATION_REG   0x0cNot present
USB_AUTOREQ_REG 0x14Not present
USB_SRP_FIX_TIME_REG0x18Not present
USB_TEARDOWN_REG0x1cNot present

USB_IRQ_MERGED_STATUS   Present as part of  0x1020 - for musb0
EP_INTR_x or CORE_INTR_x0x1820 - for 
musb1
register in am35x but   
at different offsets

USB_IRQ_EOI Same as above   0x1024 - for musb0
0x1824 - for 
musb1
USB_IRQ_STATUS_RAW_0Same as above   0x1028 - for musb0
0x1828 - for 
musb1
USB_IRQ_STATUS_RAW_1Same as above   0x102c - for musb0
0x182c - for 
musb1
USB_IRQ_STATUS_0Same as above   0x1030 - for musb0
0x1830 - for 
musb1
USB_IRQ_STATUS_1Same as above   0x1034 - for musb0
0x1834 - for 
musb1
USB_IRQ_ENABLE_SET_0Same as above   0x1038 - for musb0
0x1838 - for 
musb1
USB_IRQ_ENABLE_SET_1Same as above   0x103c - for musb0
0x183c - for 
musb1
USB_IRQ_ENABLE_CLR_0Same as above   0x1040 - for musb0
0x1840 - for 
musb1
USB_IRQ_ENABLE_CLR_1Same as above   0x1044 - for musb0
0x1844 - for 
musb1

EP_INTR_SRC_REG 0x20Present as part of 
USB_IRQ_x 
register in
ti81xx but at 
different
offsets
EP_INTR_SRC_SET_REG 0x24Same as above
EP_INTR_SRC_CLEAR_REG   0x28Same as above
EP_INTR_MASK_REG0x2c   

RE: [PATCH 6/6] usb: musb: Add support for ti81xx platform

2011-08-28 Thread Gupta, Ajay Kumar
Hi,
 On Fri, Aug 26, 2011 at 04:41:48PM +0530, Ajay Kumar Gupta wrote:
  @@ -57,6 +58,10 @@ config USB_MUSB_AM35X
  tristate AM35x
  depends on ARCH_OMAP
 
  +config USB_MUSB_TI81XX
  +   bool TI81XX
  +   depends on SOC_OMAPTI81XX
 
 this *must* be tristate. I can't emphasize enough how important this
 is.

Ok.
 
  diff --git a/drivers/usb/musb/musb_core.c
  b/drivers/usb/musb/musb_core.c index 20a2873..07f3faf 100644
  --- a/drivers/usb/musb/musb_core.c
  +++ b/drivers/usb/musb/musb_core.c
  @@ -1014,7 +1014,9 @@ static void musb_shutdown(struct
 platform_device *pdev)
  || defined(CONFIG_USB_MUSB_OMAP2PLUS)   \
  || defined(CONFIG_USB_MUSB_OMAP2PLUS_MODULE)\
  || defined(CONFIG_USB_MUSB_AM35X)   \
  -   || defined(CONFIG_USB_MUSB_AM35X_MODULE)
  +   || defined(CONFIG_USB_MUSB_AM35X_MODULE)\
  +   || defined(CONFIG_USB_MUSB_TI81XX)  \
  +   || defined(CONFIG_USB_MUSB_TI81XX_MODULE)
 
 we really need to find a better way to handle this :-(

How about passing the mode info from musb_config (musb-config-fifo_mode),
same way as musb-config-fifo_cfg 

Infact I think, we can kill musb-config-fifo_cfg and have only
musb-config-mode as in this way all the fifo tables will be at one
place and should help in maintenance.


 
  diff --git a/drivers/usb/musb/ti81xx.c b/drivers/usb/musb/ti81xx.c
 new
  file mode 100644 index 000..f95774e
  --- /dev/null
  +++ b/drivers/usb/musb/ti81xx.c
 
 I still think this should be part of am35x.c It really look like they
 are very similar.

Wrapper registers are different but I will see on this and provide you details
On how the merged file would look like. I am afraid that we may have to use
Either #ifdef or cpu_is_xxx().

 
 on monday I'll read the rest of the file.
Ok.

Ajay
 
 --
 balbi
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 6/6] usb: musb: Add support for ti81xx platform

2011-08-26 Thread Felipe Balbi
Hi,

On Fri, Aug 26, 2011 at 04:41:48PM +0530, Ajay Kumar Gupta wrote:
 @@ -57,6 +58,10 @@ config USB_MUSB_AM35X
   tristate AM35x
   depends on ARCH_OMAP
  
 +config USB_MUSB_TI81XX
 + bool TI81XX
 + depends on SOC_OMAPTI81XX

this *must* be tristate. I can't emphasize enough how important this is.

 diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
 index 20a2873..07f3faf 100644
 --- a/drivers/usb/musb/musb_core.c
 +++ b/drivers/usb/musb/musb_core.c
 @@ -1014,7 +1014,9 @@ static void musb_shutdown(struct platform_device *pdev)
   || defined(CONFIG_USB_MUSB_OMAP2PLUS)   \
   || defined(CONFIG_USB_MUSB_OMAP2PLUS_MODULE)\
   || defined(CONFIG_USB_MUSB_AM35X)   \
 - || defined(CONFIG_USB_MUSB_AM35X_MODULE)
 + || defined(CONFIG_USB_MUSB_AM35X_MODULE)\
 + || defined(CONFIG_USB_MUSB_TI81XX)  \
 + || defined(CONFIG_USB_MUSB_TI81XX_MODULE)

we really need to find a better way to handle this :-(

 diff --git a/drivers/usb/musb/ti81xx.c b/drivers/usb/musb/ti81xx.c
 new file mode 100644
 index 000..f95774e
 --- /dev/null
 +++ b/drivers/usb/musb/ti81xx.c

I still think this should be part of am35x.c It really look like they
are very similar.

on monday I'll read the rest of the file.

-- 
balbi


signature.asc
Description: Digital signature