diff mbox

[V2,RFC,6/6] ARM: dts: bcm2835: Add Raspberry Pi Zero

Message ID 1469559213-16160-7-git-send-email-stefan.wahren@i2se.com (mailing list archive)
State New, archived
Headers show

Commit Message

Stefan Wahren July 26, 2016, 6:53 p.m. UTC
The Raspberry Pi Zero is a minified version of model A+. It's
notable there is no PWR LED and the ACT LED is inverted.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
---
 arch/arm/boot/dts/Makefile             |    3 +-
 arch/arm/boot/dts/bcm2835-rpi-zero.dts |   57 ++++++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/bcm2835-rpi-zero.dts

Comments

Stephen Warren Aug. 2, 2016, 5:19 p.m. UTC | #1
On 07/26/2016 12:53 PM, Stefan Wahren wrote:
> The Raspberry Pi Zero is a minified version of model A+. It's
> notable there is no PWR LED and the ACT LED is inverted.

Patches 3-6,
Acked-by: Stephen Warren <swarren@nvidia.com>

> diff --git a/arch/arm/boot/dts/bcm2835-rpi-zero.dts b/arch/arm/boot/dts/bcm2835-rpi-zero.dts

The following comment format is a bit strange, but I'm not sure there's 
anything objectively better...

> +&usb {
> +	dr_mode = "host";
> +	h-rx-fifo-size = <774>;
> +	h-np-tx-fifo-size = <256>;
> +	h-tx-fifo-size = <512>;
> +/*
> + * Settings for otg
> + *
> +	dr_mode = "otg";
> +	h-rx-fifo-size = <774>;
> +	h-np-tx-fifo-size = <32>;
> +	h-tx-fifo-size = <0>;
> +	g-np-tx-fifo-size = <16>;
> +	g-rx-fifo-size = <256>;
> +	g-tx-fifo-size = <256 128 128 64 64 64 32>;
> + *
> + * Settings for peripheral
> + *
> +	dr_mode = "peripheral";
> +	h-rx-fifo-size = <774>;
> +	h-np-tx-fifo-size = <0>;
> +	h-tx-fifo-size = <0>;
> +	g-np-tx-fifo-size = <16>;
> +	g-rx-fifo-size = <256>;
> +	g-tx-fifo-size = <256 128 128 64 64 64 32>;
> + */
> +};
Stefan Wahren Aug. 2, 2016, 7:29 p.m. UTC | #2
Hi Stephen,

> Stephen Warren <swarren@wwwdotorg.org> hat am 2. August 2016 um 19:19
> geschrieben:
> 
> 
> On 07/26/2016 12:53 PM, Stefan Wahren wrote:
> > The Raspberry Pi Zero is a minified version of model A+. It's
> > notable there is no PWR LED and the ACT LED is inverted.
> 
> Patches 3-6,
> Acked-by: Stephen Warren <swarren@nvidia.com>
> 
> > diff --git a/arch/arm/boot/dts/bcm2835-rpi-zero.dts
> > b/arch/arm/boot/dts/bcm2835-rpi-zero.dts
> 
> The following comment format is a bit strange, but I'm not sure there's 
> anything objectively better...

the idea behind that was to provide valid values for every dr_mode with minimum
effort. I see 2 alternative solutions:
  a) add different dr_mode examples to the dwc2 => doesn't work for all
platforms
  b) add comments to drivers/usb/dwc2/platform.c => harder to find

At the end the solution here is already obsolete. This patch series doesn't
contain an update for the bcm2835_defconfig which should set the following:

CONFIG_NOP_USB_XCEIV=y
CONFIG_USB_GADGET=y

After enabling these options another issue is revealed. Currently the dr_mode
for all the other bcm283x boards isn't defined, which means "otg" instead of
intended "host". But the dwc2 driver ignores this as long as CONFIG_USB_GADGET
is not defined. So we need to define the dr_mode for all bcm283x boards. In
order to avoid such massive copy & paste, we better define 3 dtsi files for each
dr_mode.  The only catch about this solution is the modes "otg" and "peripheral"
wouldn't be referenced.

I'll wait for John's feedback before sending a new version.

Stefan

> 
> > +&usb {
> > +	dr_mode = "host";
> > +	h-rx-fifo-size = <774>;
> > +	h-np-tx-fifo-size = <256>;
> > +	h-tx-fifo-size = <512>;
> > +/*
> > + * Settings for otg
> > + *
> > +	dr_mode = "otg";
> > +	h-rx-fifo-size = <774>;
> > +	h-np-tx-fifo-size = <32>;
> > +	h-tx-fifo-size = <0>;
> > +	g-np-tx-fifo-size = <16>;
> > +	g-rx-fifo-size = <256>;
> > +	g-tx-fifo-size = <256 128 128 64 64 64 32>;
> > + *
> > + * Settings for peripheral
> > + *
> > +	dr_mode = "peripheral";
> > +	h-rx-fifo-size = <774>;
> > +	h-np-tx-fifo-size = <0>;
> > +	h-tx-fifo-size = <0>;
> > +	g-np-tx-fifo-size = <16>;
> > +	g-rx-fifo-size = <256>;
> > +	g-tx-fifo-size = <256 128 128 64 64 64 32>;
> > + */
> > +};
>
Stephen Warren Aug. 2, 2016, 8:56 p.m. UTC | #3
On 08/02/2016 01:29 PM, Stefan Wahren wrote:
> Hi Stephen,
>
>> Stephen Warren <swarren@wwwdotorg.org> hat am 2. August 2016 um 19:19
>> geschrieben:
>>
>>
>> On 07/26/2016 12:53 PM, Stefan Wahren wrote:
>>> The Raspberry Pi Zero is a minified version of model A+. It's
>>> notable there is no PWR LED and the ACT LED is inverted.
>>
>> Patches 3-6,
>> Acked-by: Stephen Warren <swarren@nvidia.com>
>>
>>> diff --git a/arch/arm/boot/dts/bcm2835-rpi-zero.dts
>>> b/arch/arm/boot/dts/bcm2835-rpi-zero.dts
>>
>> The following comment format is a bit strange, but I'm not sure there's
>> anything objectively better...
>
> the idea behind that was to provide valid values for every dr_mode with minimum
> effort. I see 2 alternative solutions:
>   a) add different dr_mode examples to the dwc2 => doesn't work for all
> platforms
>   b) add comments to drivers/usb/dwc2/platform.c => harder to find
>
> At the end the solution here is already obsolete. This patch series doesn't
> contain an update for the bcm2835_defconfig which should set the following:
>
> CONFIG_NOP_USB_XCEIV=y
> CONFIG_USB_GADGET=y
>
> After enabling these options another issue is revealed. Currently the dr_mode
> for all the other bcm283x boards isn't defined, which means "otg" instead of
> intended "host". But the dwc2 driver ignores this as long as CONFIG_USB_GADGET
> is not defined. So we need to define the dr_mode for all bcm283x boards.

Do note that the existing DTs must work with any new kernel update; 
that's part of DT being an ABI. So, there should be no need to update 
any of the existing DTs. Rather, the driver must cope with missing 
properties and operate as best it can. Perhaps that means that even if 
dr_mode is unspecified and hence defaults to otg, then if properties 
that are mandatory for OTG to operate are missing, the driver falls back 
to host mode. I think that'd be completely backwards-compatible?

 > In
> order to avoid such massive copy & paste, we better define 3 dtsi files for each
> dr_mode.

3 DT files, with an appropriate one of those included in each RPi DT, 
sounds reasonable.

> The only catch about this solution is the modes "otg" and "peripheral"
> wouldn't be referenced.

That's probably OK; in this patch the properties for those modes are in 
a comment too, so essentially unreferenced. Perhaps on RPi platforms 
where a choice is possible (Zero, A), there could be a comment next to 
the include of the "host" or "otg" version that states the user might 
want to edit the DT and include the other version instead. Then, those 
files would be somewhat referenced.
John Youn Aug. 16, 2016, 7:30 p.m. UTC | #4
On 7/26/2016 11:54 AM, Stefan Wahren wrote:
> The Raspberry Pi Zero is a minified version of model A+. It's
> notable there is no PWR LED and the ACT LED is inverted.
> 
> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
> ---
>  arch/arm/boot/dts/Makefile             |    3 +-
>  arch/arm/boot/dts/bcm2835-rpi-zero.dts |   57 ++++++++++++++++++++++++++++++++
>  2 files changed, 59 insertions(+), 1 deletion(-)
>  create mode 100644 arch/arm/boot/dts/bcm2835-rpi-zero.dts
> 
> diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
> index e38e7c9..cafa3b1 100644
> --- a/arch/arm/boot/dts/Makefile
> +++ b/arch/arm/boot/dts/Makefile
> @@ -69,7 +69,8 @@ dtb-$(CONFIG_ARCH_BCM2835) += \
>  	bcm2835-rpi-b-rev2.dtb \
>  	bcm2835-rpi-b-plus.dtb \
>  	bcm2835-rpi-a-plus.dtb \
> -	bcm2836-rpi-2-b.dtb
> +	bcm2836-rpi-2-b.dtb \
> +	bcm2835-rpi-zero.dtb
>  dtb-$(CONFIG_ARCH_BCM_5301X) += \
>  	bcm4708-asus-rt-ac56u.dtb \
>  	bcm4708-asus-rt-ac68u.dtb \
> diff --git a/arch/arm/boot/dts/bcm2835-rpi-zero.dts b/arch/arm/boot/dts/bcm2835-rpi-zero.dts
> new file mode 100644
> index 0000000..12bc82d
> --- /dev/null
> +++ b/arch/arm/boot/dts/bcm2835-rpi-zero.dts
> @@ -0,0 +1,57 @@
> +/dts-v1/;
> +#include "bcm2835.dtsi"
> +#include "bcm2835-rpi.dtsi"
> +
> +/ {
> +	compatible = "raspberrypi,model-zero", "brcm,bcm2835";
> +	model = "Raspberry Pi Zero";
> +
> +	leds {
> +		act {
> +			gpios = <&gpio 47 GPIO_ACTIVE_HIGH>;
> +		};
> +	};
> +};
> +
> +
> +&usb {
> +	dr_mode = "host";
> +	h-rx-fifo-size = <774>;
> +	h-np-tx-fifo-size = <256>;
> +	h-tx-fifo-size = <512>;

It seems like these last two are the same as the default values
reported in the registers. So they should already be set that way
without needing to specify them. If not, there may be some problem in
the driver.

> +/*
> + * Settings for otg
> + *
> +	dr_mode = "otg";
> +	h-rx-fifo-size = <774>;
> +	h-np-tx-fifo-size = <32>;
> +	h-tx-fifo-size = <0>;

This seems odd. It should be non-zero for use when operating as host.

> +	g-np-tx-fifo-size = <16>;
> +	g-rx-fifo-size = <256>;
> +	g-tx-fifo-size = <256 128 128 64 64 64 32>;
> + *
> + * Settings for peripheral
> + *
> +	dr_mode = "peripheral";
> +	h-rx-fifo-size = <774>;
> +	h-np-tx-fifo-size = <0>;
> +	h-tx-fifo-size = <0>;

You should be able to omit the host params if dr_mode == peripheral.

> +	g-np-tx-fifo-size = <16>;
> +	g-rx-fifo-size = <256>;
> +	g-tx-fifo-size = <256 128 128 64 64 64 32>;
> + */
> +};

Regards,
John
Stefan Wahren Aug. 16, 2016, 7:58 p.m. UTC | #5
Hi John,

> John Youn <John.Youn@synopsys.com> hat am 16. August 2016 um 21:30
> geschrieben:
> 
> 
> On 7/26/2016 11:54 AM, Stefan Wahren wrote:
> ...
> > +/*
> > + * Settings for otg
> > + *
> > +	dr_mode = "otg";
> > +	h-rx-fifo-size = <774>;
> > +	h-np-tx-fifo-size = <32>;
> > +	h-tx-fifo-size = <0>;
> 
> This seems odd. It should be non-zero for use when operating as host.
> 

like in host mode i took the default values in otg mode for the last two here
(please refer to the logs). The BCM2835 datasheet isn't very helpful.

Do you have any suggestions for valid values or how to get them?
John Youn Aug. 16, 2016, 10:07 p.m. UTC | #6
On 8/16/2016 12:58 PM, Stefan Wahren wrote:
> Hi John,
> 
>> John Youn <John.Youn@synopsys.com> hat am 16. August 2016 um 21:30
>> geschrieben:
>>
>>
>> On 7/26/2016 11:54 AM, Stefan Wahren wrote:
>> ...
>>> +/*
>>> + * Settings for otg
>>> + *
>>> +	dr_mode = "otg";
>>> +	h-rx-fifo-size = <774>;
>>> +	h-np-tx-fifo-size = <32>;
>>> +	h-tx-fifo-size = <0>;
>>
>> This seems odd. It should be non-zero for use when operating as host.
>>
> 
> like in host mode i took the default values in otg mode for the last two here
> (please refer to the logs). The BCM2835 datasheet isn't very helpful.
> 
> Do you have any suggestions for valid values or how to get them?
> 

The same values used in host-only mode should work.

It seems that the reset values for host-mode aren't being read
correctly with dr_mode == otg. I suspect this is the core reset and
force-mode delay problem.

Can you try with this patch series to see if you get the proper
values?

http://marc.info/?l=linux-kernel&m=145921907525708

This series fixes known issues, but it also breaks at least one
platform and I haven't had time to look at it properly yet.

Regards,
John
Stefan Wahren Aug. 17, 2016, 7:11 p.m. UTC | #7
Hi,

> John Youn <John.Youn@synopsys.com> hat am 17. August 2016 um 00:07
> geschrieben:
> 
> 
> On 8/16/2016 12:58 PM, Stefan Wahren wrote:
> > Hi John,
> > ...
> > 
> > like in host mode i took the default values in otg mode for the last two
> > here
> > (please refer to the logs). The BCM2835 datasheet isn't very helpful.
> > 
> > Do you have any suggestions for valid values or how to get them?
> > 
> 
> The same values used in host-only mode should work.
> 
> It seems that the reset values for host-mode aren't being read
> correctly with dr_mode == otg. I suspect this is the core reset and
> force-mode delay problem.
> 
> Can you try with this patch series to see if you get the proper
> values?
> 
> http://marc.info/?l=linux-kernel&m=145921907525708
> 
> This series fixes known issues, but it also breaks at least one
> platform and I haven't had time to look at it properly yet.

thanks. Yes, that seems to fix host fifo sizes for bcm2835. Here the log after
applying patch 2 - 4 and removing all DT FIFO parameters (patch 1 has already
been merged):

Linux raspberrypi 4.7.0-rc7-next-20160719+ #23 Wed Aug 17 18:15:24 UTC 2016
armv6l

[    2.290723] dwc2_lowlevel_hw_init()
[    2.298123] dwc2_lowlevel_hw_enable()
[    2.305451] dwc2_get_dr_mode()
[    2.365040] dwc2_get_hwparams()
[    2.371785] dwc2 20980000.usb: Core Release: 2.80a (snpsid=4f54280a)
[    2.371801] dwc2 20980000.usb: hwcfg1=00000000
[    2.371813] dwc2 20980000.usb: hwcfg2=228ddd50
[    2.371823] dwc2 20980000.usb: hwcfg3=0ff000e8
[    2.371833] dwc2 20980000.usb: hwcfg4=1ff00020
[    2.371843] dwc2 20980000.usb: grxfsiz=00001000
[    2.371853] dwc2 20980000.usb: Forcing mode to host
[    2.371869] dwc2 20980000.usb: gnptxfsiz=01001000
[    2.371880] dwc2 20980000.usb: hptxfsiz=02002000
[    2.371890] dwc2 20980000.usb: Forcing mode to device
[    2.423450] dwc2 20980000.usb: gnptxfsiz=00201000
[    2.423468] dwc2 20980000.usb: Detected values from hardware:
[    2.423480] dwc2 20980000.usb:   op_mode=0
[    2.423490] dwc2 20980000.usb:   arch=2
[    2.423500] dwc2 20980000.usb:   dma_desc_enable=0
[    2.423511] dwc2 20980000.usb:   power_optimized=0
[    2.423520] dwc2 20980000.usb:   i2c_enable=0
[    2.423530] dwc2 20980000.usb:   hs_phy_type=1
[    2.423540] dwc2 20980000.usb:   fs_phy_type=1
[    2.423550] dwc2 20980000.usb:   utmi_phy_data_width=0
[    2.423559] dwc2 20980000.usb:   num_dev_ep=7
[    2.423570] dwc2 20980000.usb:   num_dev_perio_in_ep=0
[    2.423579] dwc2 20980000.usb:   host_channels=8
[    2.423590] dwc2 20980000.usb:   max_transfer_size=524287
[    2.423601] dwc2 20980000.usb:   max_packet_count=1023
[    2.423611] dwc2 20980000.usb:   nperio_tx_q_depth=0x4
[    2.423621] dwc2 20980000.usb:   host_perio_tx_q_depth=0x4
[    2.423631] dwc2 20980000.usb:   dev_token_q_depth=0x8
[    2.423641] dwc2 20980000.usb:   enable_dynamic_fifo=1
[    2.423651] dwc2 20980000.usb:   en_multiple_tx_fifo=1
[    2.423661] dwc2 20980000.usb:   total_fifo_size=4080
[    2.423671] dwc2 20980000.usb:   host_rx_fifo_size=4096
[    2.423681] dwc2 20980000.usb:   host_nperio_tx_fifo_size=256
[    2.423691] dwc2 20980000.usb:   host_perio_tx_fifo_size=512
[    2.423699] dwc2 20980000.usb:
[    2.423709] dwc2 20980000.usb: dwc2_set_parameters()
[    2.423723] dwc2 20980000.usb: Setting dma_desc_fs_enable to 0
[    2.423748] dwc2 20980000.usb: Setting external_id_pin_ctl to 0
[    2.423760] dwc2 20980000.usb: Setting hibernation to 0
[    2.423777] dwc2_force_dr_mode()
[    2.430509] dwc2 20980000.usb: Clearing force mode bits
[    2.499028] dwc2_gadget_init()
[    2.505422] dwc2 20980000.usb: Specified GNPTXFDEP=1024 > 32
[    2.514502] dwc2 20980000.usb: EPs: 8, dedicated fifos, 4080 entries in SPRAM
[    2.542143] dwc2 20980000.usb: bound driver zero
[    2.550164] dwc2_hcd_init()
[    2.556602] dwc2 20980000.usb: DWC OTG Controller
[    2.564878] dwc2 20980000.usb: new USB bus registered, assigned bus number 1
[    2.575467] dwc2 20980000.usb: irq 33, io mem 0x00000000

# cat /sys/kernel/debug/20980000.usb/fifo
Non-periodic FIFOs:
RXFIFO: Size 4096
NPTXFIFO: Size 32, Start 0x00200000

Periodic TXFIFOs:
        DPTXFIFO 1: Size 512, Start 0x00001020
        DPTXFIFO 2: Size 512, Start 0x00001220
        DPTXFIFO 3: Size 512, Start 0x00001420
        DPTXFIFO 4: Size 512, Start 0x00001620
        DPTXFIFO 5: Size 512, Start 0x00001820
        DPTXFIFO 6: Size 768, Start 0x00001a20
        DPTXFIFO 7: Size 768, Start 0x00001d20
John Youn Aug. 17, 2016, 9:21 p.m. UTC | #8
On 8/17/2016 12:11 PM, Stefan Wahren wrote:
> Hi,
> 
>> John Youn <John.Youn@synopsys.com> hat am 17. August 2016 um 00:07
>> geschrieben:
>>
>>
>> On 8/16/2016 12:58 PM, Stefan Wahren wrote:
>>> Hi John,
>>> ...
>>>
>>> like in host mode i took the default values in otg mode for the last two
>>> here
>>> (please refer to the logs). The BCM2835 datasheet isn't very helpful.
>>>
>>> Do you have any suggestions for valid values or how to get them?
>>>
>>
>> The same values used in host-only mode should work.
>>
>> It seems that the reset values for host-mode aren't being read
>> correctly with dr_mode == otg. I suspect this is the core reset and
>> force-mode delay problem.
>>
>> Can you try with this patch series to see if you get the proper
>> values?
>>
>> http://marc.info/?l=linux-kernel&m=145921907525708
>>
>> This series fixes known issues, but it also breaks at least one
>> platform and I haven't had time to look at it properly yet.
> 
> thanks. Yes, that seems to fix host fifo sizes for bcm2835. Here the log after
> applying patch 2 - 4 and removing all DT FIFO parameters (patch 1 has already
> been merged):
> 
> Linux raspberrypi 4.7.0-rc7-next-20160719+ #23 Wed Aug 17 18:15:24 UTC 2016
> armv6l
> 
> [    2.290723] dwc2_lowlevel_hw_init()
> [    2.298123] dwc2_lowlevel_hw_enable()
> [    2.305451] dwc2_get_dr_mode()
> [    2.365040] dwc2_get_hwparams()
> [    2.371785] dwc2 20980000.usb: Core Release: 2.80a (snpsid=4f54280a)
> [    2.371801] dwc2 20980000.usb: hwcfg1=00000000
> [    2.371813] dwc2 20980000.usb: hwcfg2=228ddd50
> [    2.371823] dwc2 20980000.usb: hwcfg3=0ff000e8
> [    2.371833] dwc2 20980000.usb: hwcfg4=1ff00020
> [    2.371843] dwc2 20980000.usb: grxfsiz=00001000
> [    2.371853] dwc2 20980000.usb: Forcing mode to host
> [    2.371869] dwc2 20980000.usb: gnptxfsiz=01001000
> [    2.371880] dwc2 20980000.usb: hptxfsiz=02002000
> [    2.371890] dwc2 20980000.usb: Forcing mode to device
> [    2.423450] dwc2 20980000.usb: gnptxfsiz=00201000
> [    2.423468] dwc2 20980000.usb: Detected values from hardware:
> [    2.423480] dwc2 20980000.usb:   op_mode=0
> [    2.423490] dwc2 20980000.usb:   arch=2
> [    2.423500] dwc2 20980000.usb:   dma_desc_enable=0
> [    2.423511] dwc2 20980000.usb:   power_optimized=0
> [    2.423520] dwc2 20980000.usb:   i2c_enable=0
> [    2.423530] dwc2 20980000.usb:   hs_phy_type=1
> [    2.423540] dwc2 20980000.usb:   fs_phy_type=1
> [    2.423550] dwc2 20980000.usb:   utmi_phy_data_width=0
> [    2.423559] dwc2 20980000.usb:   num_dev_ep=7
> [    2.423570] dwc2 20980000.usb:   num_dev_perio_in_ep=0
> [    2.423579] dwc2 20980000.usb:   host_channels=8
> [    2.423590] dwc2 20980000.usb:   max_transfer_size=524287
> [    2.423601] dwc2 20980000.usb:   max_packet_count=1023
> [    2.423611] dwc2 20980000.usb:   nperio_tx_q_depth=0x4
> [    2.423621] dwc2 20980000.usb:   host_perio_tx_q_depth=0x4
> [    2.423631] dwc2 20980000.usb:   dev_token_q_depth=0x8
> [    2.423641] dwc2 20980000.usb:   enable_dynamic_fifo=1
> [    2.423651] dwc2 20980000.usb:   en_multiple_tx_fifo=1
> [    2.423661] dwc2 20980000.usb:   total_fifo_size=4080
> [    2.423671] dwc2 20980000.usb:   host_rx_fifo_size=4096
> [    2.423681] dwc2 20980000.usb:   host_nperio_tx_fifo_size=256
> [    2.423691] dwc2 20980000.usb:   host_perio_tx_fifo_size=512
> [    2.423699] dwc2 20980000.usb:
> [    2.423709] dwc2 20980000.usb: dwc2_set_parameters()
> [    2.423723] dwc2 20980000.usb: Setting dma_desc_fs_enable to 0
> [    2.423748] dwc2 20980000.usb: Setting external_id_pin_ctl to 0
> [    2.423760] dwc2 20980000.usb: Setting hibernation to 0
> [    2.423777] dwc2_force_dr_mode()
> [    2.430509] dwc2 20980000.usb: Clearing force mode bits
> [    2.499028] dwc2_gadget_init()
> [    2.505422] dwc2 20980000.usb: Specified GNPTXFDEP=1024 > 32
> [    2.514502] dwc2 20980000.usb: EPs: 8, dedicated fifos, 4080 entries in SPRAM
> [    2.542143] dwc2 20980000.usb: bound driver zero
> [    2.550164] dwc2_hcd_init()
> [    2.556602] dwc2 20980000.usb: DWC OTG Controller
> [    2.564878] dwc2 20980000.usb: new USB bus registered, assigned bus number 1
> [    2.575467] dwc2 20980000.usb: irq 33, io mem 0x00000000
> 

Ok, yeah, that seems better.

Can you check if applying just patch 2 and 3 solves the issue? If so I
think we can send those upstream.

Regards,
John
Stefan Wahren Aug. 17, 2016, 10:17 p.m. UTC | #9
Hi John,

> John Youn <John.Youn@synopsys.com> hat am 17. August 2016 um 23:21
> geschrieben:
> 
> 
> ...
> Ok, yeah, that seems better.
> 
> Can you check if applying just patch 2 and 3 solves the issue? If so I
> think we can send those upstream.

unfortunately not:

[    2.280719] dwc2_lowlevel_hw_init()
[    2.288028] dwc2_set_all_params()
[    2.295162] dwc2_lowlevel_hw_enable()
[    2.302439] dwc2_get_dr_mode()
[    2.309043] dwc2_core_reset_and_force_dr_mode()
[    2.489040] dwc2_get_hwparams()
[    2.495629] dwc2 20980000.usb: Core Release: 2.80a (snpsid=4f54280a)
[    2.495645] dwc2 20980000.usb: hwcfg1=00000000
[    2.495657] dwc2 20980000.usb: hwcfg2=228ddd50
[    2.495668] dwc2 20980000.usb: hwcfg3=0ff000e8
[    2.495680] dwc2 20980000.usb: hwcfg4=1ff00020
[    2.495691] dwc2 20980000.usb: grxfsiz=00001000
[    2.495701] dwc2 20980000.usb: Forcing mode to host
[    2.539076] dwc2 20980000.usb: gnptxfsiz=00201000
[    2.539090] dwc2 20980000.usb: hptxfsiz=00000000
[    2.589054] dwc2 20980000.usb: gnptxfsiz=00201000
[    2.589071] dwc2 20980000.usb: Detected values from hardware:
[    2.589082] dwc2 20980000.usb:   op_mode=0
[    2.589093] dwc2 20980000.usb:   arch=2
[    2.589104] dwc2 20980000.usb:   dma_desc_enable=0
[    2.589115] dwc2 20980000.usb:   power_optimized=0
[    2.589125] dwc2 20980000.usb:   i2c_enable=0
[    2.589134] dwc2 20980000.usb:   hs_phy_type=1
[    2.589144] dwc2 20980000.usb:   fs_phy_type=1
[    2.589154] dwc2 20980000.usb:   utmi_phy_data_width=0
[    2.589164] dwc2 20980000.usb:   num_dev_ep=7
[    2.589174] dwc2 20980000.usb:   num_dev_perio_in_ep=0
[    2.589183] dwc2 20980000.usb:   host_channels=8
[    2.589195] dwc2 20980000.usb:   max_transfer_size=524287
[    2.589206] dwc2 20980000.usb:   max_packet_count=1023
[    2.589216] dwc2 20980000.usb:   nperio_tx_q_depth=0x4
[    2.589226] dwc2 20980000.usb:   host_perio_tx_q_depth=0x4
[    2.589236] dwc2 20980000.usb:   dev_token_q_depth=0x8
[    2.589247] dwc2 20980000.usb:   enable_dynamic_fifo=1
[    2.589257] dwc2 20980000.usb:   en_multiple_tx_fifo=1
[    2.589267] dwc2 20980000.usb:   total_fifo_size=4080
[    2.589277] dwc2 20980000.usb:   host_rx_fifo_size=4096
[    2.589287] dwc2 20980000.usb:   host_nperio_tx_fifo_size=32
[    2.589299] dwc2 20980000.usb:   host_perio_tx_fifo_size=0
[    2.589307] dwc2 20980000.usb:
[    2.589312] dwc2_set_parameters()
[    2.595921] dwc2 20980000.usb: dwc2_set_parameters()
[    2.595940] dwc2 20980000.usb: Setting dma_desc_fs_enable to 0
[    2.595968] dwc2 20980000.usb: Setting external_id_pin_ctl to 0
[    2.595980] dwc2 20980000.usb: Setting hibernation to 0
[    2.596003] dwc2 20980000.usb: 256 invalid for host_nperio_tx_fifo_size.
Check HW configuration.
[    2.611528] dwc2 20980000.usb: Setting host_nperio_tx_fifo_size to 32
[    2.611552] dwc2 20980000.usb: 512 invalid for host_perio_tx_fifo_size. Check
HW configuration.
[    2.627250] dwc2 20980000.usb: Setting host_perio_tx_fifo_size to 0
[    2.627256] dwc2_force_dr_mode()
[    2.749035] dwc2_gadget_init()
[    2.755610] dwc2 20980000.usb: Specified GNPTXFDEP=1024 > 32
[    2.764876] dwc2 20980000.usb: EPs: 8, dedicated fifos, 4080 entries in SPRAM
[    2.792911] dwc2 20980000.usb: bound driver zero
[    2.801042] dwc2_hcd_init()
[    2.807485] dwc2 20980000.usb: DWC OTG Controller
[    2.815716] dwc2 20980000.usb: new USB bus registered, assigned bus number 1
[    2.826265] dwc2 20980000.usb: irq 33, io mem 0x00000000

Regards
Stefan

> 
> Regards,
> John
John Youn Aug. 18, 2016, 6:03 p.m. UTC | #10
On 8/17/2016 3:17 PM, Stefan Wahren wrote:
> Hi John,
> 
>> John Youn <John.Youn@synopsys.com> hat am 17. August 2016 um 23:21
>> geschrieben:
>>
>>
>> ...
>> Ok, yeah, that seems better.
>>
>> Can you check if applying just patch 2 and 3 solves the issue? If so I
>> think we can send those upstream.
> 
> unfortunately not:

Ok. I'll see if I can come up with a more conservative version of
patch 4 until I can look at it properly. I'll try to get to this
sometime next week but I may not be able to get to it until later.

In the meantime, specifying the fifo sizes as you've done can serve as
a workaround.

Regards,
John
Stefan Wahren Aug. 18, 2016, 7:04 p.m. UTC | #11
Hi John,

> John Youn <John.Youn@synopsys.com> hat am 18. August 2016 um 20:03
> geschrieben:
> 
> 
> On 8/17/2016 3:17 PM, Stefan Wahren wrote:
> > Hi John,
> > 
> >> John Youn <John.Youn@synopsys.com> hat am 17. August 2016 um 23:21
> >> geschrieben:
> >>
> >>
> >> ...
> >> Ok, yeah, that seems better.
> >>
> >> Can you check if applying just patch 2 and 3 solves the issue? If so I
> >> think we can send those upstream.
> > 
> > unfortunately not:
> 
> Ok. I'll see if I can come up with a more conservative version of
> patch 4 until I can look at it properly. I'll try to get to this
> sometime next week but I may not be able to get to it until later.

Great

> 
> In the meantime, specifying the fifo sizes as you've done can serve as
> a workaround.

Beside of this workaround, do you see any benefit of patch 2/6 from my series?

I don't want to introduce DT properties which are only useful for workarounds?

Thanks
Stefan

> 
> Regards,
> John
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
John Youn Aug. 18, 2016, 7:34 p.m. UTC | #12
On 8/18/2016 12:04 PM, Stefan Wahren wrote:
> Hi John,
> 
>> John Youn <John.Youn@synopsys.com> hat am 18. August 2016 um 20:03
>> geschrieben:
>>
>>
>> On 8/17/2016 3:17 PM, Stefan Wahren wrote:
>>> Hi John,
>>>
>>>> John Youn <John.Youn@synopsys.com> hat am 17. August 2016 um 23:21
>>>> geschrieben:
>>>>
>>>>
>>>> ...
>>>> Ok, yeah, that seems better.
>>>>
>>>> Can you check if applying just patch 2 and 3 solves the issue? If so I
>>>> think we can send those upstream.
>>>
>>> unfortunately not:
>>
>> Ok. I'll see if I can come up with a more conservative version of
>> patch 4 until I can look at it properly. I'll try to get to this
>> sometime next week but I may not be able to get to it until later.
> 
> Great
> 
>>
>> In the meantime, specifying the fifo sizes as you've done can serve as
>> a workaround.
> 
> Beside of this workaround, do you see any benefit of patch 2/6 from my series?
> 
> I don't want to introduce DT properties which are only useful for workarounds?

Does everything work fine if you don't set any parameters, and use my
patches from before? If so, and if you're willing to wait for the fix
to those patches then I don't see a need for it.

They would be useful beyond a workaround, if only for our internal
test platform, but we don't need it right away.

Regards,
John
diff mbox

Patch

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index e38e7c9..cafa3b1 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -69,7 +69,8 @@  dtb-$(CONFIG_ARCH_BCM2835) += \
 	bcm2835-rpi-b-rev2.dtb \
 	bcm2835-rpi-b-plus.dtb \
 	bcm2835-rpi-a-plus.dtb \
-	bcm2836-rpi-2-b.dtb
+	bcm2836-rpi-2-b.dtb \
+	bcm2835-rpi-zero.dtb
 dtb-$(CONFIG_ARCH_BCM_5301X) += \
 	bcm4708-asus-rt-ac56u.dtb \
 	bcm4708-asus-rt-ac68u.dtb \
diff --git a/arch/arm/boot/dts/bcm2835-rpi-zero.dts b/arch/arm/boot/dts/bcm2835-rpi-zero.dts
new file mode 100644
index 0000000..12bc82d
--- /dev/null
+++ b/arch/arm/boot/dts/bcm2835-rpi-zero.dts
@@ -0,0 +1,57 @@ 
+/dts-v1/;
+#include "bcm2835.dtsi"
+#include "bcm2835-rpi.dtsi"
+
+/ {
+	compatible = "raspberrypi,model-zero", "brcm,bcm2835";
+	model = "Raspberry Pi Zero";
+
+	leds {
+		act {
+			gpios = <&gpio 47 GPIO_ACTIVE_HIGH>;
+		};
+	};
+};
+
+
+&usb {
+	dr_mode = "host";
+	h-rx-fifo-size = <774>;
+	h-np-tx-fifo-size = <256>;
+	h-tx-fifo-size = <512>;
+/*
+ * Settings for otg
+ *
+	dr_mode = "otg";
+	h-rx-fifo-size = <774>;
+	h-np-tx-fifo-size = <32>;
+	h-tx-fifo-size = <0>;
+	g-np-tx-fifo-size = <16>;
+	g-rx-fifo-size = <256>;
+	g-tx-fifo-size = <256 128 128 64 64 64 32>;
+ *
+ * Settings for peripheral
+ *
+	dr_mode = "peripheral";
+	h-rx-fifo-size = <774>;
+	h-np-tx-fifo-size = <0>;
+	h-tx-fifo-size = <0>;
+	g-np-tx-fifo-size = <16>;
+	g-rx-fifo-size = <256>;
+	g-tx-fifo-size = <256 128 128 64 64 64 32>;
+ */
+};
+
+&gpio {
+	pinctrl-0 = <&gpioout &alt0 &i2s_alt0 &alt3>;
+
+	/* I2S interface */
+	i2s_alt0: i2s_alt0 {
+		brcm,pins = <18 19 20 21>;
+		brcm,function = <BCM2835_FSEL_ALT0>;
+	};
+};
+
+&hdmi {
+	hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>;
+};