diff mbox

[U-Boot,v2,1/6] h2200: Add support for iPAQ h2200 palmtop

Message ID 1348410936-335-2-git-send-email-luk0104@gmail.com
State Superseded
Headers show

Commit Message

Łukasz Dałek Sept. 23, 2012, 2:35 p.m. UTC
Basic support of HP iPAQ h2200 palmtop. Support includes also USB
ethernet gadget.

Signed-off-by: Lukasz Dalek <luk0104@gmail.com>
---
 board/h2200/Makefile       |   51 ++++++++++++
 board/h2200/h2200-header.S |   27 ++++++
 board/h2200/h2200.c        |   66 +++++++++++++++
 board/h2200/h2200.h        |   28 +++++++
 boards.cfg                 |    2 +
 include/configs/h2200.h    |  189 ++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 363 insertions(+), 0 deletions(-)
 create mode 100644 board/h2200/Makefile
 create mode 100644 board/h2200/h2200-header.S
 create mode 100644 board/h2200/h2200.c
 create mode 100644 board/h2200/h2200.h
 create mode 100644 include/configs/h2200.h

Comments

Marek Vasut Sept. 23, 2012, 3:43 p.m. UTC | #1
Dear Lukasz Dalek,

[...]

> +int dram_init(void)
> +{
> +	/*
> +	 * Everything except MSC0 was already set up by
> +	 * 1st stage bootloader
> +	 */
> +	clrsetbits_le32(MSC0, 0xffffffff, 0x246c7ffc);

This magic would use more description eventually.

> +	gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
> +	return 0;
> +}
> diff --git a/board/h2200/h2200.h b/board/h2200/h2200.h
> new file mode 100644

Do you need this file at all? Can the udc_disconnect() not be put somewhere into 
usb.h ?

[...]

Rest seems fine, thanks.

Best regards,
Marek Vasut
Łukasz Dałek Sept. 23, 2012, 7:11 p.m. UTC | #2
On 23.09.2012 17:43, Marek Vasut wrote:
>> +	gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
>> +	return 0;
>> +}
>> diff --git a/board/h2200/h2200.h b/board/h2200/h2200.h
>> new file mode 100644
> Do you need this file at all? Can the udc_disconnect() not be put somewhere into
> usb.h ?

Can I just move this declaration into h2200.c?

Łukasz Dałek
Marek Vasut Sept. 23, 2012, 7:31 p.m. UTC | #3
Dear Łukasz Dałek,

> On 23.09.2012 17:43, Marek Vasut wrote:
> >> +	gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
> >> +	return 0;
> >> +}
> >> diff --git a/board/h2200/h2200.h b/board/h2200/h2200.h
> >> new file mode 100644
> > 
> > Do you need this file at all? Can the udc_disconnect() not be put
> > somewhere into usb.h ?
> 
> Can I just move this declaration into h2200.c?

extern ... ? No, checkpatch will scream and extern is prohibited for a good 
reason.

> Łukasz Dałek

Best regards,
Marek Vasut
Łukasz Dałek Sept. 23, 2012, 7:39 p.m. UTC | #4
On 23.09.2012 21:31, Marek Vasut wrote:
> Dear Łukasz Dałek,
>
>> On 23.09.2012 17:43, Marek Vasut wrote:
>>>> +	gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
>>>> +	return 0;
>>>> +}
>>>> diff --git a/board/h2200/h2200.h b/board/h2200/h2200.h
>>>> new file mode 100644
>>> Do you need this file at all? Can the udc_disconnect() not be put
>>> somewhere into usb.h ?
>> Can I just move this declaration into h2200.c?
> extern ... ? No, checkpatch will scream and extern is prohibited for a good
> reason.

So where should I put it?

Łukasz Dałek
Marek Vasut Sept. 23, 2012, 8:05 p.m. UTC | #5
Dear Łukasz Dałek,

> On 23.09.2012 21:31, Marek Vasut wrote:
> > Dear Łukasz Dałek,
> > 
> >> On 23.09.2012 17:43, Marek Vasut wrote:
> >>>> +	gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
> >>>> +	return 0;
> >>>> +}
> >>>> diff --git a/board/h2200/h2200.h b/board/h2200/h2200.h
> >>>> new file mode 100644
> >>> 
> >>> Do you need this file at all? Can the udc_disconnect() not be put
> >>> somewhere into usb.h ?
> >> 
> >> Can I just move this declaration into h2200.c?
> > 
> > extern ... ? No, checkpatch will scream and extern is prohibited for a
> > good reason.
> 
> So where should I put it?

Isn't it a general call? some include/usb.h ?

> Łukasz Dałek

Best regards,
Marek Vasut
Łukasz Dałek Sept. 23, 2012, 8:24 p.m. UTC | #6
On 23.09.2012 22:05, Marek Vasut wrote:
> Dear Łukasz Dałek,
>
>> On 23.09.2012 21:31, Marek Vasut wrote:
>>> Dear Łukasz Dałek,
>>>
>>>> On 23.09.2012 17:43, Marek Vasut wrote:
>>>>>> +	gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
>>>>>> +	return 0;
>>>>>> +}
>>>>>> diff --git a/board/h2200/h2200.h b/board/h2200/h2200.h
>>>>>> new file mode 100644
>>>>> Do you need this file at all? Can the udc_disconnect() not be put
>>>>> somewhere into usb.h ?
>>>> Can I just move this declaration into h2200.c?
>>> extern ... ? No, checkpatch will scream and extern is prohibited for a
>>> good reason.
>> So where should I put it?
> Isn't it a general call? some include/usb.h ?
>
For old layer maybe it is.

I'm not sure but include/usb.h is for device implementing usb host but
pxa can only be device. Including usb.h generate error.

I'm going to add sd card support and other functions, maybe leaving it
would be better idea?

Łukasz Dałek
Marek Vasut Sept. 23, 2012, 8:52 p.m. UTC | #7
Dear Łukasz Dałek,

> On 23.09.2012 22:05, Marek Vasut wrote:
> > Dear Łukasz Dałek,
> > 
> >> On 23.09.2012 21:31, Marek Vasut wrote:
> >>> Dear Łukasz Dałek,
> >>> 
> >>>> On 23.09.2012 17:43, Marek Vasut wrote:
> >>>>>> +	gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
> >>>>>> +	return 0;
> >>>>>> +}
> >>>>>> diff --git a/board/h2200/h2200.h b/board/h2200/h2200.h
> >>>>>> new file mode 100644
> >>>>> 
> >>>>> Do you need this file at all? Can the udc_disconnect() not be put
> >>>>> somewhere into usb.h ?
> >>>> 
> >>>> Can I just move this declaration into h2200.c?
> >>> 
> >>> extern ... ? No, checkpatch will scream and extern is prohibited for a
> >>> good reason.
> >> 
> >> So where should I put it?
> > 
> > Isn't it a general call? some include/usb.h ?
> 
> For old layer maybe it is.
> 
> I'm not sure but include/usb.h is for device implementing usb host but
> pxa can only be device.

PXA can be both, actually u-boot is mostly about host. Just put it there.

> Including usb.h generate error.
> 
> I'm going to add sd card support and other functions, maybe leaving it
> would be better idea?

Why do you think usb.h is not a good place ?

> Łukasz Dałek

Best regards,
Marek Vasut
Łukasz Dałek Sept. 23, 2012, 9 p.m. UTC | #8
On 23.09.2012 22:52, Marek Vasut wrote:
> Dear Łukasz Dałek,
>
>> On 23.09.2012 22:05, Marek Vasut wrote:
>>> Dear Łukasz Dałek,
>>>
>>>> On 23.09.2012 21:31, Marek Vasut wrote:
>>>>> Dear Łukasz Dałek,
>>>>>
>>>>>> On 23.09.2012 17:43, Marek Vasut wrote:
>>>>>>>> +	gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
>>>>>>>> +	return 0;
>>>>>>>> +}
>>>>>>>> diff --git a/board/h2200/h2200.h b/board/h2200/h2200.h
>>>>>>>> new file mode 100644
>>>>>>> Do you need this file at all? Can the udc_disconnect() not be put
>>>>>>> somewhere into usb.h ?
>>>>>> Can I just move this declaration into h2200.c?
>>>>> extern ... ? No, checkpatch will scream and extern is prohibited for a
>>>>> good reason.
>>>> So where should I put it?
>>> Isn't it a general call? some include/usb.h ?
>> For old layer maybe it is.
>>
>> I'm not sure but include/usb.h is for device implementing usb host but
>> pxa can only be device.
> PXA can be both, actually u-boot is mostly about host. Just put it there.
>
>> Including usb.h generate error.
>>
>> I'm going to add sd card support and other functions, maybe leaving it
>> would be better idea?
> Why do you think usb.h is not a good place ?
Because:
#if defined(CONFIG_USB_UHCI) || defined(CONFIG_USB_OHCI) || \
     defined(CONFIG_USB_EHCI) || defined(CONFIG_USB_OHCI_NEW) || \
     defined(CONFIG_USB_SL811HS) || defined(CONFIG_USB_ISP116X_HCD) || \
     defined(CONFIG_USB_R8A66597_HCD) || defined(CONFIG_USB_DAVINCI) || \
     defined(CONFIG_USB_OMAP3) || defined(CONFIG_USB_DA8XX) || \
     defined(CONFIG_USB_BLACKFIN) || defined(CONFIG_USB_AM35X)
...
#else
#error USB Lowlevel not defined
#endif

All of these definitions are usb host implementation (maybe OTG too) but pxa
cannot be host.

Łukasz Dałek
Marek Vasut Sept. 23, 2012, 9:04 p.m. UTC | #9
Dear Łukasz Dałek,

> On 23.09.2012 22:52, Marek Vasut wrote:
> > Dear Łukasz Dałek,
> > 
> >> On 23.09.2012 22:05, Marek Vasut wrote:
> >>> Dear Łukasz Dałek,
> >>> 
> >>>> On 23.09.2012 21:31, Marek Vasut wrote:
> >>>>> Dear Łukasz Dałek,
> >>>>> 
> >>>>>> On 23.09.2012 17:43, Marek Vasut wrote:
> >>>>>>>> +	gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
> >>>>>>>> +	return 0;
> >>>>>>>> +}
> >>>>>>>> diff --git a/board/h2200/h2200.h b/board/h2200/h2200.h
> >>>>>>>> new file mode 100644
> >>>>>>> 
> >>>>>>> Do you need this file at all? Can the udc_disconnect() not be put
> >>>>>>> somewhere into usb.h ?
> >>>>>> 
> >>>>>> Can I just move this declaration into h2200.c?
> >>>>> 
> >>>>> extern ... ? No, checkpatch will scream and extern is prohibited for
> >>>>> a good reason.
> >>>> 
> >>>> So where should I put it?
> >>> 
> >>> Isn't it a general call? some include/usb.h ?
> >> 
> >> For old layer maybe it is.
> >> 
> >> I'm not sure but include/usb.h is for device implementing usb host but
> >> pxa can only be device.
> > 
> > PXA can be both, actually u-boot is mostly about host. Just put it there.
> > 
> >> Including usb.h generate error.
> >> 
> >> I'm going to add sd card support and other functions, maybe leaving it
> >> would be better idea?
> > 
> > Why do you think usb.h is not a good place ?
> 
> Because:
> #if defined(CONFIG_USB_UHCI) || defined(CONFIG_USB_OHCI) || \
>      defined(CONFIG_USB_EHCI) || defined(CONFIG_USB_OHCI_NEW) || \
>      defined(CONFIG_USB_SL811HS) || defined(CONFIG_USB_ISP116X_HCD) || \
>      defined(CONFIG_USB_R8A66597_HCD) || defined(CONFIG_USB_DAVINCI) || \
>      defined(CONFIG_USB_OMAP3) || defined(CONFIG_USB_DA8XX) || \
>      defined(CONFIG_USB_BLACKFIN) || defined(CONFIG_USB_AM35X)
> ...
> #else
> #error USB Lowlevel not defined
> #endif
> 
> All of these definitions are usb host implementation (maybe OTG too) but
> pxa cannot be host.

PXA2xx is OHCI host with one OTG port.

what about include/usb/pxa27x_udc.h ... btw can't pxa27x and pxa25x UDC use the 
same driver?

> Łukasz Dałek

Best regards,
Marek Vasut
Łukasz Dałek Sept. 23, 2012, 9:11 p.m. UTC | #10
On 23.09.2012 23:04, Marek Vasut wrote:
> Dear Łukasz Dałek,
>
>> On 23.09.2012 22:52, Marek Vasut wrote:
>>> Dear Łukasz Dałek,
>>>
>>>> On 23.09.2012 22:05, Marek Vasut wrote:
>>>>> Dear Łukasz Dałek,
>>>>>
>>>>>> On 23.09.2012 21:31, Marek Vasut wrote:
>>>>>>> Dear Łukasz Dałek,
>>>>>>>
>>>>>>>> On 23.09.2012 17:43, Marek Vasut wrote:
>>>>>>>>>> +	gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
>>>>>>>>>> +	return 0;
>>>>>>>>>> +}
>>>>>>>>>> diff --git a/board/h2200/h2200.h b/board/h2200/h2200.h
>>>>>>>>>> new file mode 100644
>>>>>>>>> Do you need this file at all? Can the udc_disconnect() not be put
>>>>>>>>> somewhere into usb.h ?
>>>>>>>> Can I just move this declaration into h2200.c?
>>>>>>> extern ... ? No, checkpatch will scream and extern is prohibited for
>>>>>>> a good reason.
>>>>>> So where should I put it?
>>>>> Isn't it a general call? some include/usb.h ?
>>>> For old layer maybe it is.
>>>>
>>>> I'm not sure but include/usb.h is for device implementing usb host but
>>>> pxa can only be device.
>>> PXA can be both, actually u-boot is mostly about host. Just put it there.
>>>
>>>> Including usb.h generate error.
>>>>
>>>> I'm going to add sd card support and other functions, maybe leaving it
>>>> would be better idea?
>>> Why do you think usb.h is not a good place ?
>> Because:
>> #if defined(CONFIG_USB_UHCI) || defined(CONFIG_USB_OHCI) || \
>>       defined(CONFIG_USB_EHCI) || defined(CONFIG_USB_OHCI_NEW) || \
>>       defined(CONFIG_USB_SL811HS) || defined(CONFIG_USB_ISP116X_HCD) || \
>>       defined(CONFIG_USB_R8A66597_HCD) || defined(CONFIG_USB_DAVINCI) || \
>>       defined(CONFIG_USB_OMAP3) || defined(CONFIG_USB_DA8XX) || \
>>       defined(CONFIG_USB_BLACKFIN) || defined(CONFIG_USB_AM35X)
>> ...
>> #else
>> #error USB Lowlevel not defined
>> #endif
>>
>> All of these definitions are usb host implementation (maybe OTG too) but
>> pxa cannot be host.
> PXA2xx is OHCI host with one OTG port.

 From pxa255 documentation:
"The UDC supports 16 endpoints and can operate half-duplex at a rate of 
12 Mbps (as a slave only,
not as a host or hub controller)."

> what about include/usb/pxa27x_udc.h ... btw can't pxa27x and pxa25x UDC use the
> same driver?

pxa27x_udc driver is using older layer which doesn't work with usb 
ethernet driver.

Btw. pxa27x can be host, pxa25x can't.

Łukasz Dałek
Marek Vasut Sept. 23, 2012, 9:31 p.m. UTC | #11
Dear Łukasz Dałek,

> On 23.09.2012 23:04, Marek Vasut wrote:
> > Dear Łukasz Dałek,
> > 
> >> On 23.09.2012 22:52, Marek Vasut wrote:
> >>> Dear Łukasz Dałek,
> >>> 
> >>>> On 23.09.2012 22:05, Marek Vasut wrote:
> >>>>> Dear Łukasz Dałek,
> >>>>> 
> >>>>>> On 23.09.2012 21:31, Marek Vasut wrote:
> >>>>>>> Dear Łukasz Dałek,
> >>>>>>> 
> >>>>>>>> On 23.09.2012 17:43, Marek Vasut wrote:
> >>>>>>>>>> +	gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
> >>>>>>>>>> +	return 0;
> >>>>>>>>>> +}
> >>>>>>>>>> diff --git a/board/h2200/h2200.h b/board/h2200/h2200.h
> >>>>>>>>>> new file mode 100644
> >>>>>>>>> 
> >>>>>>>>> Do you need this file at all? Can the udc_disconnect() not be put
> >>>>>>>>> somewhere into usb.h ?
> >>>>>>>> 
> >>>>>>>> Can I just move this declaration into h2200.c?
> >>>>>>> 
> >>>>>>> extern ... ? No, checkpatch will scream and extern is prohibited
> >>>>>>> for a good reason.
> >>>>>> 
> >>>>>> So where should I put it?
> >>>>> 
> >>>>> Isn't it a general call? some include/usb.h ?
> >>>> 
> >>>> For old layer maybe it is.
> >>>> 
> >>>> I'm not sure but include/usb.h is for device implementing usb host but
> >>>> pxa can only be device.
> >>> 
> >>> PXA can be both, actually u-boot is mostly about host. Just put it
> >>> there.
> >>> 
> >>>> Including usb.h generate error.
> >>>> 
> >>>> I'm going to add sd card support and other functions, maybe leaving it
> >>>> would be better idea?
> >>> 
> >>> Why do you think usb.h is not a good place ?
> >> 
> >> Because:
> >> #if defined(CONFIG_USB_UHCI) || defined(CONFIG_USB_OHCI) || \
> >> 
> >>       defined(CONFIG_USB_EHCI) || defined(CONFIG_USB_OHCI_NEW) || \
> >>       defined(CONFIG_USB_SL811HS) || defined(CONFIG_USB_ISP116X_HCD) ||
> >>       \ defined(CONFIG_USB_R8A66597_HCD) || defined(CONFIG_USB_DAVINCI)
> >>       || \ defined(CONFIG_USB_OMAP3) || defined(CONFIG_USB_DA8XX) || \
> >>       defined(CONFIG_USB_BLACKFIN) || defined(CONFIG_USB_AM35X)
> >> 
> >> ...
> >> #else
> >> #error USB Lowlevel not defined
> >> #endif
> >> 
> >> All of these definitions are usb host implementation (maybe OTG too) but
> >> pxa cannot be host.
> > 
> > PXA2xx is OHCI host with one OTG port.
> 
>  From pxa255 documentation:
> "The UDC supports 16 endpoints and can operate half-duplex at a rate of
> 12 Mbps (as a slave only,
> not as a host or hub controller)."
> 
> > what about include/usb/pxa27x_udc.h ... btw can't pxa27x and pxa25x UDC
> > use the same driver?
> 
> pxa27x_udc driver is using older layer which doesn't work with usb
> ethernet driver.
> 
> Btw. pxa27x can be host, pxa25x can't.

Can you update the new gadget driver to be compatible with pxa27x then ?

> Łukasz Dałek

Best regards,
Marek Vasut
Łukasz Dałek Sept. 23, 2012, 9:43 p.m. UTC | #12
On 23.09.2012 23:31, Marek Vasut wrote:
> Dear Łukasz Dałek,
>
>> On 23.09.2012 23:04, Marek Vasut wrote:
>>
>>> PXA2xx is OHCI host with one OTG port.
>>    From pxa255 documentation:
>> "The UDC supports 16 endpoints and can operate half-duplex at a rate of
>> 12 Mbps (as a slave only,
>> not as a host or hub controller)."
>>
>>> what about include/usb/pxa27x_udc.h ... btw can't pxa27x and pxa25x UDC
>>> use the same driver?
>> pxa27x_udc driver is using older layer which doesn't work with usb
>> ethernet driver.
>>
>> Btw. pxa27x can be host, pxa25x can't.
> Can you update the new gadget driver to be compatible with pxa27x then ?
I don't have any board with pxa27x processor. And I'm quite sure that
differences between pxa25x and pxa27x usb are too big. Even in
Linux kernel are two separate drivers for 25x and 27x chips.

Łukasz Dałek
Marek Vasut Sept. 23, 2012, 11:05 p.m. UTC | #13
Dear Łukasz Dałek,

> On 23.09.2012 23:31, Marek Vasut wrote:
> > Dear Łukasz Dałek,
> > 
> >> On 23.09.2012 23:04, Marek Vasut wrote:
> >>> PXA2xx is OHCI host with one OTG port.
> >>> 
> >>    From pxa255 documentation:
> >> "The UDC supports 16 endpoints and can operate half-duplex at a rate of
> >> 12 Mbps (as a slave only,
> >> not as a host or hub controller)."
> >> 
> >>> what about include/usb/pxa27x_udc.h ... btw can't pxa27x and pxa25x UDC
> >>> use the same driver?
> >> 
> >> pxa27x_udc driver is using older layer which doesn't work with usb
> >> ethernet driver.
> >> 
> >> Btw. pxa27x can be host, pxa25x can't.
> > 
> > Can you update the new gadget driver to be compatible with pxa27x then ?
> 
> I don't have any board with pxa27x processor. And I'm quite sure that
> differences between pxa25x and pxa27x usb are too big. Even in
> Linux kernel are two separate drivers for 25x and 27x chips.

Isn't the 25x only a subset of the 27x ?

> Łukasz Dałek

Best regards,
Marek Vasut
Łukasz Dałek Sept. 23, 2012, 11:16 p.m. UTC | #14
On 24.09.2012 01:05, Marek Vasut wrote:
> Dear Łukasz Dałek,
>
>> On 23.09.2012 23:31, Marek Vasut wrote:
>>> Dear Łukasz Dałek,
>>>
>>>> On 23.09.2012 23:04, Marek Vasut wrote:
>>>>> PXA2xx is OHCI host with one OTG port.
>>>>>
>>>>      From pxa255 documentation:
>>>> "The UDC supports 16 endpoints and can operate half-duplex at a rate of
>>>> 12 Mbps (as a slave only,
>>>> not as a host or hub controller)."
>>>>
>>>>> what about include/usb/pxa27x_udc.h ... btw can't pxa27x and pxa25x UDC
>>>>> use the same driver?
>>>> pxa27x_udc driver is using older layer which doesn't work with usb
>>>> ethernet driver.
>>>>
>>>> Btw. pxa27x can be host, pxa25x can't.
>>> Can you update the new gadget driver to be compatible with pxa27x then ?
>> I don't have any board with pxa27x processor. And I'm quite sure that
>> differences between pxa25x and pxa27x usb are too big. Even in
>> Linux kernel are two separate drivers for 25x and 27x chips.
> Isn't the 25x only a subset of the 27x ?
>
Maybe it is.

You've asked me if I could update driver to compatible with pxa27x and my
answer is no. Maybe someone with pxa27x chip could.

I will left that h2200.h header. I'm sure that it will be helpful some day.

Łukasz Dałek
Marek Vasut Sept. 23, 2012, 11:25 p.m. UTC | #15
Dear Łukasz Dałek,

> On 24.09.2012 01:05, Marek Vasut wrote:
> > Dear Łukasz Dałek,
> > 
> >> On 23.09.2012 23:31, Marek Vasut wrote:
> >>> Dear Łukasz Dałek,
> >>> 
> >>>> On 23.09.2012 23:04, Marek Vasut wrote:
> >>>>> PXA2xx is OHCI host with one OTG port.
> >>>>> 
> >>>>      From pxa255 documentation:
> >>>> "The UDC supports 16 endpoints and can operate half-duplex at a rate
> >>>> of 12 Mbps (as a slave only,
> >>>> not as a host or hub controller)."
> >>>> 
> >>>>> what about include/usb/pxa27x_udc.h ... btw can't pxa27x and pxa25x
> >>>>> UDC use the same driver?
> >>>> 
> >>>> pxa27x_udc driver is using older layer which doesn't work with usb
> >>>> ethernet driver.
> >>>> 
> >>>> Btw. pxa27x can be host, pxa25x can't.
> >>> 
> >>> Can you update the new gadget driver to be compatible with pxa27x then
> >>> ?
> >> 
> >> I don't have any board with pxa27x processor. And I'm quite sure that
> >> differences between pxa25x and pxa27x usb are too big. Even in
> >> Linux kernel are two separate drivers for 25x and 27x chips.
> > 
> > Isn't the 25x only a subset of the 27x ?
> 
> Maybe it is.
> 
> You've asked me if I could update driver to compatible with pxa27x and my
> answer is no. Maybe someone with pxa27x chip could.

I can test it. It'd be good to have only one driver and get rid of the old one 
seems to be the way to go.

> I will left that h2200.h header. I'm sure that it will be helpful some day.

For what exactly? Just put it into include/usb.h .

> Łukasz Dałek

Best regards,
Marek Vasut
Łukasz Dałek Sept. 23, 2012, 11:39 p.m. UTC | #16
On 24.09.2012 01:25, Marek Vasut wrote:
> Dear Łukasz Dałek,
>
>> On 24.09.2012 01:05, Marek Vasut wrote:
>>> Dear Łukasz Dałek,
>>>
>>>> On 23.09.2012 23:31, Marek Vasut wrote:
>>>>> Dear Łukasz Dałek,
>>>>>
>>>>>> On 23.09.2012 23:04, Marek Vasut wrote:
>>>>>>> PXA2xx is OHCI host with one OTG port.
>>>>>>>
>>>>>>        From pxa255 documentation:
>>>>>> "The UDC supports 16 endpoints and can operate half-duplex at a rate
>>>>>> of 12 Mbps (as a slave only,
>>>>>> not as a host or hub controller)."
>>>>>>
>>>>>>> what about include/usb/pxa27x_udc.h ... btw can't pxa27x and pxa25x
>>>>>>> UDC use the same driver?
>>>>>> pxa27x_udc driver is using older layer which doesn't work with usb
>>>>>> ethernet driver.
>>>>>>
>>>>>> Btw. pxa27x can be host, pxa25x can't.
>>>>> Can you update the new gadget driver to be compatible with pxa27x then
>>>>> ?
>>>> I don't have any board with pxa27x processor. And I'm quite sure that
>>>> differences between pxa25x and pxa27x usb are too big. Even in
>>>> Linux kernel are two separate drivers for 25x and 27x chips.
>>> Isn't the 25x only a subset of the 27x ?
>> Maybe it is.
>>
>> You've asked me if I could update driver to compatible with pxa27x and my
>> answer is no. Maybe someone with pxa27x chip could.
> I can test it. It'd be good to have only one driver and get rid of the old one
> seems to be the way to go.

Does this driver work with usb ethernet gadget?

>
>> I will left that h2200.h header. I'm sure that it will be helpful some day.
> For what exactly? Just put it into include/usb.h .
I can't. It doesn't compile because of #error at 170 line.

Łukasz Dałek
Marek Vasut Sept. 24, 2012, 1:23 a.m. UTC | #17
Dear Łukasz Dałek,

> On 24.09.2012 01:25, Marek Vasut wrote:
> > Dear Łukasz Dałek,
> > 
> >> On 24.09.2012 01:05, Marek Vasut wrote:
> >>> Dear Łukasz Dałek,
> >>> 
> >>>> On 23.09.2012 23:31, Marek Vasut wrote:
> >>>>> Dear Łukasz Dałek,
> >>>>> 
> >>>>>> On 23.09.2012 23:04, Marek Vasut wrote:
> >>>>>>> PXA2xx is OHCI host with one OTG port.
> >>>>>>> 
> >>>>>>        From pxa255 documentation:
> >>>>>> "The UDC supports 16 endpoints and can operate half-duplex at a rate
> >>>>>> of 12 Mbps (as a slave only,
> >>>>>> not as a host or hub controller)."
> >>>>>> 
> >>>>>>> what about include/usb/pxa27x_udc.h ... btw can't pxa27x and pxa25x
> >>>>>>> UDC use the same driver?
> >>>>>> 
> >>>>>> pxa27x_udc driver is using older layer which doesn't work with usb
> >>>>>> ethernet driver.
> >>>>>> 
> >>>>>> Btw. pxa27x can be host, pxa25x can't.
> >>>>> 
> >>>>> Can you update the new gadget driver to be compatible with pxa27x
> >>>>> then ?
> >>>> 
> >>>> I don't have any board with pxa27x processor. And I'm quite sure that
> >>>> differences between pxa25x and pxa27x usb are too big. Even in
> >>>> Linux kernel are two separate drivers for 25x and 27x chips.
> >>> 
> >>> Isn't the 25x only a subset of the 27x ?
> >> 
> >> Maybe it is.
> >> 
> >> You've asked me if I could update driver to compatible with pxa27x and
> >> my answer is no. Maybe someone with pxa27x chip could.
> > 
> > I can test it. It'd be good to have only one driver and get rid of the
> > old one seems to be the way to go.
> 
> Does this driver work with usb ethernet gadget?

I have no idea, I never used it (and I'm not quite sure it's used at all). It's 
a rotting piece of code, maybe we should throw it out altogether.

> >> I will left that h2200.h header. I'm sure that it will be helpful some
> >> day.
> > 
> > For what exactly? Just put it into include/usb.h .
> 
> I can't. It doesn't compile because of #error at 170 line.

You know ... #elif defined () is your friend there. Besides seriously, it'd be 
very nice to share the error message if nothing else ...

> Łukasz Dałek

Best regards,
Marek Vasut
diff mbox

Patch

diff --git a/board/h2200/Makefile b/board/h2200/Makefile
new file mode 100644
index 0000000..2265aa9
--- /dev/null
+++ b/board/h2200/Makefile
@@ -0,0 +1,51 @@ 
+#
+# h2200 Support
+#
+# Copyright (C) 2012 Lukasz Dalek <luk0104@gmail.com>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(BOARD).o
+
+COBJS	:= h2200.o
+
+SRCS	:= $(COBJS:.o=.c) h2200-header.S
+OBJS	:= $(addprefix $(obj),$(COBJS))
+
+ALL: $(LIB) h2200-header.bin
+
+h2200-header.o: h2200-header.S
+	$(CC) $(CFLAGS) -c -o $@ $<
+
+h2200-header.bin: h2200-header.o
+	$(OBJCOPY) -O binary $< $@
+
+all: $(LIB) h2200-header.bin
+
+$(LIB):	$(obj).depend $(OBJS)
+	$(call cmd_link_o_target, $(OBJS))
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/h2200/h2200-header.S b/board/h2200/h2200-header.S
new file mode 100644
index 0000000..c335bfe
--- /dev/null
+++ b/board/h2200/h2200-header.S
@@ -0,0 +1,27 @@ 
+/*
+ * iPAQ h2200 header
+ *
+ * Copyright (C) 2012 Lukasz Dalek <luk0104@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+	.word 0xea0003fe /* b 0x1000 */
+
+	.org 0x40
+	.ascii "ECEC"
+
+	.org 0x1000 - 1
+	.byte 0x0
diff --git a/board/h2200/h2200.c b/board/h2200/h2200.c
new file mode 100644
index 0000000..a6b1c48
--- /dev/null
+++ b/board/h2200/h2200.c
@@ -0,0 +1,66 @@ 
+/*
+ * iPAQ h2200 board configuration
+ *
+ * Copyright (C) 2012 Lukasz Dalek <luk0104@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <common.h>
+#include <asm/arch/pxa.h>
+#include <asm/arch/pxa-regs.h>
+#include <asm/io.h>
+#include "h2200.h"
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#ifdef CONFIG_H2200_USBETH
+int board_eth_init(bd_t *bis)
+{
+	usb_eth_initialize(bis);
+	return 0;
+}
+#endif
+
+int board_init(void)
+{
+	/* We have RAM, disable cache */
+	dcache_disable();
+	icache_disable();
+
+	gd->bd->bi_arch_number = MACH_TYPE_H2200;
+
+	/* adress of boot parameters */
+	gd->bd->bi_boot_params = 0xa0000100;
+
+	/* Let host see that device is disconnected */
+#if defined(CONFIG_H2200_USBETH)
+	udc_disconnect();
+	mdelay(500);
+#endif
+
+	return 0;
+}
+
+int dram_init(void)
+{
+	/*
+	 * Everything except MSC0 was already set up by
+	 * 1st stage bootloader
+	 */
+	clrsetbits_le32(MSC0, 0xffffffff, 0x246c7ffc);
+	gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
+	return 0;
+}
diff --git a/board/h2200/h2200.h b/board/h2200/h2200.h
new file mode 100644
index 0000000..237e0eb
--- /dev/null
+++ b/board/h2200/h2200.h
@@ -0,0 +1,28 @@ 
+/*
+ * iPAQ h2200 board configuration
+ *
+ * Copyright (C) 2012 Lukasz Dalek <luk0104@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef __IPAQ_H2200_H
+#define __IPAQ_H2200_H
+
+#if defined(CONFIG_H2200_USBETH)
+extern void udc_disconnect(void);
+#endif
+
+#endif /* __IPAQ_H2200_H */
diff --git a/boards.cfg b/boards.cfg
index b4e0d3c..a03a469 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -282,6 +282,8 @@  dvlhost                      arm         ixp
 pdnb3                        arm         ixp         pdnb3               prodrive
 scpu                         arm         ixp         pdnb3               prodrive       -           pdnb3:SCPU
 balloon3                     arm         pxa
+h2200                        arm         pxa
+h2200_usbeth                 arm         pxa         h2200               -              -           h2200:H2200_USBETH
 lubbock                      arm         pxa
 palmld                       arm         pxa
 palmtc                       arm         pxa
diff --git a/include/configs/h2200.h b/include/configs/h2200.h
new file mode 100644
index 0000000..1062ec0
--- /dev/null
+++ b/include/configs/h2200.h
@@ -0,0 +1,189 @@ 
+/*
+ * iPAQ h2200 board configuration
+ *
+ * Copyright (C) 2012 Lukasz Dalek <luk0104@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#define MACH_TYPE_H2200			341
+#define CONFIG_MACH_TYPE		MACH_TYPE_H2200
+
+#define CONFIG_CPU_PXA25X		1
+#define CONFIG_BOARD_H2200
+
+#define CONFIG_SYS_NO_FLASH
+
+#define CONFIG_SYS_HZ			1000
+
+#define CONFIG_NR_DRAM_BANKS		1
+#define PHYS_SDRAM_1			0xa0000000 /* SDRAM Bank #1 */
+#define PHYS_SDRAM_1_SIZE		0x04000000 /* 64 MB */
+
+#define CONFIG_SYS_SDRAM_BASE		PHYS_SDRAM_1
+#define CONFIG_SYS_SDRAM_SIZE		PHYS_SDRAM_1_SIZE
+
+#define CONFIG_SYS_INIT_SP_ADDR		0xfffff800
+
+#define CONFIG_ENV_SIZE			0x00040000
+#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 128*1024)
+
+#define CONFIG_ENV_IS_NOWHERE
+#define CONFIG_SYS_MAXARGS		16
+#define CONFIG_SYS_LOAD_ADDR		0xa3000000 /* default load address */
+
+/*
+ * iPAQ 1st stage bootloader loads 2nd stage bootloader
+ * at address 0xa0040000 but bootloader requires header
+ * which is 0x1000 long.
+ *
+ * --- Header begin ---
+ *	.word 0xea0003fe ; b 0x1000
+ *
+ *	.org 0x40
+ *	.ascii "ECEC"
+ *
+ *	.org 0x1000
+ * --- Header end ---
+ */
+
+#define CONFIG_SYS_TEXT_BASE		0xa0041000
+
+/*
+ * Static chips
+ */
+
+#define CONFIG_SYS_MSC0_VAL		0x246c7ffc
+#define CONFIG_SYS_MSC1_VAL		0x7ff07ff0
+#define CONFIG_SYS_MSC2_VAL		0x7ff07ff0
+
+/*
+ * PCMCIA and CF Interfaces
+ */
+
+#define CONFIG_SYS_MECR_VAL		0x00000000
+#define CONFIG_SYS_MCMEM0_VAL		0x00000000
+#define CONFIG_SYS_MCMEM1_VAL		0x00000000
+#define CONFIG_SYS_MCATT0_VAL		0x00000000
+#define CONFIG_SYS_MCATT1_VAL		0x00000000
+#define CONFIG_SYS_MCIO0_VAL		0x00000000
+#define CONFIG_SYS_MCIO1_VAL		0x00000000
+
+#define CONFIG_SYS_FLYCNFG_VAL		0x00000000
+#define CONFIG_SYS_SXCNFG_VAL		0x00040004
+
+#define CONFIG_SYS_MDREFR_VAL		0x0099E018
+#define CONFIG_SYS_MDCNFG_VAL		0x01C801CB
+#define CONFIG_SYS_MDMRS_VAL		0x00220022
+
+#define CONFIG_SYS_PSSR_VAL		0x00000000
+#define CONFIG_SYS_CKEN			0x00004840
+#define CONFIG_SYS_CCCR			0x00000161
+
+/*
+ * GPIOs
+ */
+
+#define CONFIG_SYS_GPSR0_VAL		0x01000000
+#define CONFIG_SYS_GPSR1_VAL		0x00000000
+#define CONFIG_SYS_GPSR2_VAL		0x00010000
+
+#define CONFIG_SYS_GPCR0_VAL		0x00000000
+#define CONFIG_SYS_GPCR1_VAL		0x00000000
+#define CONFIG_SYS_GPCR2_VAL		0x00000000
+
+#define CONFIG_SYS_GPDR0_VAL		0xF7E38C00
+#define CONFIG_SYS_GPDR1_VAL		0xBCFFBF83
+#define CONFIG_SYS_GPDR2_VAL		0x000157FF
+
+#define CONFIG_SYS_GAFR0_L_VAL		0x80401000
+#define CONFIG_SYS_GAFR0_U_VAL		0x00000112
+#define CONFIG_SYS_GAFR1_L_VAL		0x600A9550
+#define CONFIG_SYS_GAFR1_U_VAL		0x0005AAAA
+#define CONFIG_SYS_GAFR2_L_VAL		0x20000000
+#define CONFIG_SYS_GAFR2_U_VAL		0x00000000
+
+/*
+ * Serial port
+ */
+
+#define CONFIG_PXA_SERIAL
+#define CONFIG_FFUART
+
+#define CONFIG_BAUDRATE			115200
+#define CONFIG_SYS_BAUDRATE_TABLE	{ 9600, 38400, 115200 }
+
+/*
+ * USB device configuration
+ */
+
+#define CONFIG_SYS_CONSOLE_IS_IN_ENV
+#define CONFIG_USB_DEV_PULLUP_GPIO	33
+/* USB VBUS GPIO 3 */
+
+#define CONFIG_CMD_LOADB
+#define CONFIG_CMD_IMPORTENV		1
+#define CONFIG_CMD_SOURCE
+#define CONFIG_CMD_RUN
+#define CONFIG_CMD_IMI
+
+/* Monitor Command Prompt */
+#define CONFIG_SYS_PROMPT		"> "
+
+/* Console I/O Buffer Size */
+#define CONFIG_SYS_CBSIZE		256
+
+/* Print Buffer Size */
+#define CONFIG_SYS_PBSIZE		(CONFIG_SYS_CBSIZE + \
+					sizeof(CONFIG_SYS_PROMPT) + 16)
+
+#define CONFIG_BOOTARGS "root=/dev/ram0 ro console=ttyS0,115200n8"
+
+#ifdef CONFIG_H2200_USBETH
+# define CONFIG_USB_ETH_SUBSET
+# define CONFIG_SYS_HUSH_PARSER
+# define CONFIG_SYS_PROMPT_HUSH_PS2	"$ "
+
+# define CONFIG_CMD_NET
+# define CONFIG_CMD_PING
+
+# define CONFIG_BOOTDELAY		2
+
+# define CONFIG_BOOTCOMMAND		\
+	"setenv downloaded 0 ; while test $downloaded -eq 0 ; do " \
+	"if bootp ; then setenv downloaded 1 ; fi ; done ; " \
+	"source :script ; " \
+	"bootm ; "
+
+# define CONFIG_USB_GADGET_PXA2XX
+
+# define CONFIG_FIT
+# define CONFIG_SETUP_MEMORY_TAGS
+# define CONFIG_CMDLINE_TAG
+# define CONFIG_INITRD_TAG
+
+# define CONFIG_USB_ETHER
+# define CONFIG_USBNET_DEV_ADDR		"de:ad:be:ef:00:01"
+# define CONFIG_USBNET_HOST_ADDR	"de:ad:be:ef:00:02"
+# define CONFIG_EXTRA_ENV_SETTINGS \
+	"stdin=serial\0" \
+	"stdout=serial\0" \
+	"stderr=serial\0"
+#endif
+
+#endif /* __CONFIG_H */