ENGR00274895 net: fec: allow to allocate the enough DMA size for BD.

Allow to allocate the enough DMA memory for buffer description
(cherry-pick from commit: bba2e3a5e24c64db1f9b1555803d1e8f1840aade)

Signed-off-by: Fugang Duan <B38611@freescale.com>
ENGR00271574 ptp: fix ptp packet parse issue to support VLAN

Previous ptp test environment is base on IPv4, now add VLAN
(virtual local area network) support. Fix the ptp packet parse
issue to support it.

PTP test on VLAN environment:
- Enable kernel config "CONFIG_FEC_1588", and rebuild
- After kernel up, dhcp require IP address for eth0
- Use vconfig to add virtual netdev eth0.n (exp: eth0.5):
    vconfig add eth0 5
- Use ifconfig to config virtual netdev eth5, and config
  real netdev eth0 to 0.0.0.0:
    ifconfig eth0.5 192.168.0.100 netmask 255.255.255.0 up
    ifconfig eth0 0.0.0.0
- If connect switch, enable switch VLAN feature and add the
  related ptp device ports to VID 5.
- Last, run the IXXAT stack V1.05.03:
    ptp_main_1.05.03 -d -o -m -l -w -z -i 0:eth0.5

Signed-off-by: Fugang Duan  <B38611@freescale.com>
ENGR00276253: net:fec: fix the up/down issue

When Ethernet ports (i.Mx28) and router/switch/server ports are in
auto mode, everything works fine, but when the router/switch/server
forces the communication to Half duplex or full duplex, the i.MX28
ethernet interface is constantly Up and Down. This is happening at
10Mbps, 100Mbps and auto speed mode.

If do phy reset during speed/duplex change, phy enter to abnormal
status that cause link status is unstable. So, only do phy reset
before ethx interface open.

Signed-off-by: Fugang Duan  <B38611@freescale.com>
ENGR00277886-1 mx28 FEC: L2 switch does not work in 10 Base-T network

The L2 switch driver can't work in 10Base-T network, because the default
driver does not identify the network conditions base on PHY setting. It
just use the default 100Mbps setting.

This code identifies the network speed and configure the PHY appropriately

Signed-off-by: Peter Chan <B18700@freescale.com>
ENGR00277886-2 mx28 FEC: L2 switch does not work in 10 Base-T network

L2 switch driver also does not work when the 2 ethernet connectors are
connecting to a half duplex and a full duplex network respectively. It is
because the driver saves the two ethernet phy link speed into the same
variable parameter. Because this parameter across the 2 networks is
different, the driver thinks thta link state is always changing and it
re-configure the PHY endlessly.

This code saves and recalls the duplex parameter for the 2 networks
separately

Signed-off-by: Peter Chan <B18700@freescale.com>
ENGR00277886-3 mx28 FEC: L2 switch does not work in 10 Base-T network

After "ifconfig eth0 down" and then "ifconfig eth0 up", the L2 switch
driver will not work. It is because when the L2 switch driver stops, it
will set PHY to power down mode in switch_enet_close(). But when the
L2 switch driver re-started in function switch_enet_open(), the PHY does
not pull out of power down mode.

This code put the PHY out of power down mode when restart

Signed-off-by: Peter Chan <B18700@freescale.com>
ENGR00273297 EPDC fb: completion timeout error due to choosing a busy LUT

The epdc_submit_work_func() checks the LUT status and choose the first idle LUT
for a new update. When a LUT completion interrupt occurs, the LUT status will
change to idle and the handler will notify another workqueue function to
process the completion. If a LUT completion interrupt occurs during the
epdc_submit_work_func() function context, this idle LUT whose status has just
changed may be chosen again to start a new EPD update. If this happens, the
LUT completion software processing will be skipped and this will lead to
timeout error.

The solution is to always choose a free LUT which is idle and not associates
with any software processing by
- In epdc_get_next_lut(), checks both the EPDC_STATUS_LUTS and EPDC_IRQ
- remove the obsolete epdc_lut_complete_intr() call in epdc_intr_work_func()
  since the EPDC_IRQ_MASK has been cleared in the IRQ handler.

Signed-off-by: Peter Chan <B18700@freescale.com>
ENGR00285435 Fix USB crash on MX53

The below crash was seen when a USB storage device is plugged to the Host
port on MX53 QSB. Commit 08c82b59a39b41dfb2afe5dfa8249fe9642bf20d
introduced this failure on MX5, this patch fixes this crash.

root@imx53qsb:~# usb wakeup is here
irq 14: nobody cared (try booting with the "irqpoll" option)
[<80036b74>] (unwind_backtrace+0x0/0xe0) from [<80420a24>]
(__report_bad_irq.isra.2+0x34/0x8c)
[<80420a24>] (__report_bad_irq.isra.2+0x34/0x8c) from [<800966e8>]
(note_interrupt+0x148/0x1d8)
[<800966e8>] (note_interrupt+0x148/0x1d8) from [<80096cb4>]
(handle_level_irq+0xf4/0x180)
[<80096cb4>] (handle_level_irq+0xf4/0x180) from [<80032068>]
(asm_do_IRQ+0x68/0x88)
[<80032068>] (asm_do_IRQ+0x68/0x88) from [<8042724c>]
(__irq_svc+0x4c/0xcc)
Exception stack(0xdf10dec0 to 0xdf10df08)
dec0: 00000001 00000000 0010f7be 00000002 df08e700 df10c000 8086aa40 dfb3a700
dee0: df08e89c 00000003 00000001 df10df2c dfb3ae38 df10df08 801fe924 80424fe8
df00: 00000113 ffffffff
[<8042724c>] (__irq_svc+0x4c/0xcc) from [<80424fe8>]
(schedule+0x258/0x3d4)
[<80424fe8>] (schedule+0x258/0x3d4) from [<80425884>]
(schedule_timeout+0x18/0x1d8)
[<80425884>] (schedule_timeout+0x18/0x1d8) from [<80425420>]
(wait_for_common+0xe8/0x1a8)
[<80425420>] (wait_for_common+0xe8/0x1a8) from [<80425520>]
(wait_for_completion_interruptible+0x14/0x20)
[<80425520>] (wait_for_completion_interruptible+0x14/0x20) from [<8004d444>]
(wakeup_event_thread+0x3c/0x170)
[<8004d444>] (wakeup_event_thread+0x3c/0x170) from [<80076c70>]
(kthread+0x78/0x80)
[<80076c70>] (kthread+0x78/0x80) from [<80033274>]
(kernel_thread_exit+0x0/0x8)
handlers:
[<8004d578>] (usb_wakeup_handler+0x0/0xdc)
[<802c6dfc>] (ehci_fsl_pre_irq+0x0/0x68)
[<802b2df0>] (usb_hcd_irq+0x0/0x7c)
Disabling IRQ #14

Signed-off-by: Mahesh Mahadevan <Mahesh.Mahadevan@freescale.com>