Re: [RFC/PATCH 2/2] usb: dwc3: core: split host address space

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Felipe,

> Hi,
>
> On Wed, Apr 18, 2012 at 04:55:58AM -0700, Ido Shayevitz wrote:
>>
>> > Hi,
>> >
>> > On Sun, Apr 15, 2012 at 04:40:24AM -0700, Ido Shayevitz wrote:
>> >>
>> >> > This will prevent dwc3.ko from ioremapping
>> >> > the entire memory space, thus preventing xHCI
>> >> > from requesting its own part of the address.
>> >> >
>> >> > Signed-off-by: Felipe Balbi <balbi@xxxxxx>
>> >> > ---
>> >> >  drivers/usb/dwc3/core.c |   26 +++++++---
>> >> >  drivers/usb/dwc3/core.h |  122
>> >> > +++++++++++++++++++++++------------------------
>> >> >  2 files changed, 80 insertions(+), 68 deletions(-)
>> >> >
>> >> > diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
>> >> > index e7c853a..3c69d1a 100644
>> >> > --- a/drivers/usb/dwc3/core.c
>> >> > +++ b/drivers/usb/dwc3/core.c
>> >> > @@ -405,6 +405,7 @@ static void dwc3_core_exit(struct dwc3 *dwc)
>> >> >  static int __devinit dwc3_probe(struct platform_device *pdev)
>> >> >  {
>> >> >  	struct device_node	*node = pdev->dev.of_node;
>> >> > +	struct resource		host_resource[2];
>> >> >  	struct resource		*res;
>> >> >  	struct dwc3		*dwc;
>> >> >  	struct device		*dev = &pdev->dev;
>> >> > @@ -431,7 +432,24 @@ static int __devinit dwc3_probe(struct
>> >> > platform_device *pdev)
>> >> >  		return -ENODEV;
>> >> >  	}
>> >> >
>> >> > -	dwc->res = res;
>> >> > +	irq = platform_get_irq(pdev, 0);
>> >> > +	if (irq < 0) {
>> >> > +		dev_err(dev, "missing IRQ\n");
>> >> > +		return -ENODEV;
>> >> > +	}
>> >> > +
>> >> > +	host_resource[0].start = res->start;
>> >> > +	host_resource[0].end = res->start + 0x7fff;
>> >> > +	host_resource[0].flags = IORESOURCE_MEM;
>> >>
>> >> You set the memory end region to end after 0x7fff, but later you
>> assign
>> >> it
>> >> to dwc->res , meaning that this is memory for all the dwc3 core and
>> not
>> >> just for the host part.
>> >
>> > no dude I guess you misunderstood.
>> >
>> > start + 0x7fff is the end of the xHCI address space. dwc->res gets
>> > passed to xHCI driver on host.c
>>
>> Yes I know, but host.c only uses dwc->res->start and set the end address
>> by itself. If you want that the only meaning of dwc->res to pass the
>> resource to host.c, maybe better rename it, or just pass it as argument
>> to
>> host_init
>
> true, that needs to be changed as well ;-)
>
>> >> So, instead, maybe create a local array used for non xhci resource:
>> >> struct resource	mem_res_exclude_xhci[1];
>> >> ...
>> >> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> >> ...
>> >> mem_res_exclude_xhci[0].start = res->start + 0xc100;
>> >> mem_res_exclude_xhci[0].end = res->end;
>> >> mem_res_exclude_xhci[0].flags = res.flags;
>> >
>> > and at which point do we let xHCI know what address it should request
>> > and ioremap ?
>>
>> It is already known to the XHCI, isn't it ?
>>
>> From host.c :
>>
>> /* setup resources */
>> generic_resources[0].start = dwc->irq;
>>
>> generic_resources[1].start = dwc->res->start;
>> generic_resources[1].end = dwc->res->start + 0x7fff;
>
> that needs to change, I will drop generic_resources array and just pass
> dwc->res.

I am at exactly the same stage, testing xCHI on dwc3, so I need this fix
too. Do you want me to help in this and patch the fix ?

Also what do you think of what I suggested about not changing the
addresses in core.h, but instead changing dwc3_readl and dwc3_writel ?

> --
> balbi
>

Thanks,
Ido
-- 
Consultant for Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum

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


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux