net: stmmac: fix NULL pointer dereference in stmmac_get_tx_hwtstamp

When timestamping is enabled, stmmac_tx_clean will call
stmmac_get_tx_hwtstamp to get tx TS.
But the skb can be NULL because the last of its tx_skbuff is NULL
if this packet frame is filled in more than one descriptors.

To fix the issue, change the code:
- Store TX skb to the tx_skbuff[] of frame's last segment.
- Check skb is not NULL in stmmac_get_tx_hwtstamp.

Signed-off-by: Bruce Liu <damuzi000@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
FogBugz #179457: Abstract EDAC module triggers

The EDAC module only has 1 trigger at this time(L2). Additional
triggers will be added for testing the ECC functionality of
future modules.
The EDAC triggers can be abstracted becaue each trigger needs
the 1)allocate memory, 2)perform the trigger, and then 3)free
memory.

V2:
Breaking the modules out into separate files makes the EDAC
device manager code cleaner and more modular for possible future
ECC additions.

V3:
Cleanup of code including the following:
- Fix order of header files.
- Add linefeed to end of makefile.
- Use devm_kzalloc() to free memory automatically.
- Use new structure pointer for cleaner code.

V4:
- Fix free() test.

Signed-off-by: Thor Thayer <tthayer@altera.com>
usb: dwc2: handle the Host Port Interrupt when it occurs in device mode

According to the spec for the DWC2 controller, when the PRTINT interrupt fires,
the application must clear the appropriate status bit in the Host Port Control
and Status register to clear this bit.

When disconnecting an A-cable when the dwc2 host driver, the PRTINT fires, but
only the GINTSTS_PRTINT status is cleared, no action is done with the HPRT0
register. The HPRT0_ENACHG bit in the HPRT0 must also be poked to correctly
clear the GINTSTS_PRTINT interrupt.

I am seeing this behavoir on v2.93 of the DWC2 IP. When I disconnect an OTG
A-cable adapter, the PRTINT interrupt fires when the DWC2 is in device mode
and is never cleared.

This patch adds the function to read the HPRT0 register when the PRTINT fires
and the dwc2 IP has already transitioned to device mode. This function is only
clearing the HPRT0_ENACHG bit for now, but can be modified to handle more.

Signed-off-by: Dinh Nguyen <dinguyen@altera.com>
[ paulz: modified patch to preserve HPRT0_ENA bit ]
Signed-off-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
FogBugz #180349: nios2: timer: Use panic() as error condition

There's not much to do if we don't have timer as clocksource.
Use panic() and show a meaningful error.

Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Ley Foon Tan <lftan@altera.com>
FogBugz #180363: nios2: timer: Fix interrupt mapping error check

The 'irq' type must be signed in order to check for negative values.

Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Ley Foon Tan <lftan@altera.com>
FogBugz #180381: nios2: timer: Use CLOCKSOURCE_OF to setup the timer

This allows to clean-up the code a bit, making it more readable
and consistent architecture-wide.

Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Ley Foon Tan <lftan@altera.com>
FogBugz #128579: Altera GPIO upstream updates

This change is to address feedbacks from the Linux community on upstreaming
the Altera GPIO driver. This includes updating the device tree binding
naming convensions, coding style, etc.

Signed-off-by: Tien Hock Loh <thloh@altera.com>
FogBugz #183175: Fix clock driver to support multiple parents for PLLs

The clock driver was incorrectly setting the num_parents=1 for all the
PLL clocks. The sdram_pll and periph_pll can have 1 of 3 different parents.

Signed-off-by: Dinh Nguyen <dinguyen@altera.com>
Tested-by: Matthew Gerlach <mgerlach@altera.com>
checkpatch: only flag FSF address, not gnu.org URL

This change restricts the check for the for the FSF address in the GPL
copyright statement so that it only flags the address, not the
references to the gnu.org/licenses URL which appears to be used in
numerous drivers.  The idea is to still allow some reference to an
external copy of the GPL in the event that files are copied out of the
kernel tree without the COPYING file.

So for example this statement will still return an error:
  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.

However, this statement will not return an error after this patch:
  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Conflicts:

	scripts/checkpatch.pl
FogBugz #183586: nios2: Use checking for ALTR,pid-num-ways

Remove checking for ALTR,has-mmu and use ALTR,pid-num-ways instead for
backward compatibility. pid-num-ways shouldn't be 0 if MMU is enabled.
This also can prevent division by zero exception when divide with
cpuinfo.tlb_num_ways later.

Signed-off-by: Ley Foon Tan <lftan@altera.com>
FogBugz #177284: add Altera VIP framebuffer driver

This adds support for the Altera framebuffer that uses the Altera VIP
Frame Reader hardware.

V2:
-Removed old SGDMA code
-Fixed more styling and formatting issues
-Changed module author
-Fixed license header
-Added device tree bindings documentation
-Fixed bug with altfb_remove
-Fixed bug in altfb_probe with error path

V3:
-updated dev tree bindings doc
-replaced of_get_property with of_property_read_u32
-fixed module license
-replaced kzalloc with devm_kzalloc
-replaced ioremap/request_mem_region with devm_ioremap_resource
-added disable hardware function during unprobe
-removed more remnants of SGDMA
-renamed altfb to altvipfb

V4:
-changed "Altera framebuffer" to "Altera VIP framebuffer"

V5:
-removed static data structures
-cleaned up error path
-removed 16bit pixel code

V6:
-expanded "VIP" to "Video and Image Processing" in some descriptions
-removed dependency on EMBEDDED in Kconfig

V7:
-changed altvipfb_start_hw and altvipfb_disable_hw to return void

V8:
-fixed comment in altvipfb_disable_hw

V9:
-added "altr,vip-frame-reader-1.0" compatible string

Signed-off-by: Chris Rauer <crauer@altera.com>
FogBugz #173188: Add OCRAM ECC Error Injection for testing.

OCRAM ECC error injection was added for testing the OCRAM EDAC
functionality. The OCRAM testing function allocates memory from
the general purpose allocation pool, sets the error injection
bits, writes data out (corrupted by error injection logic),
then reads the data back out (which triggers the EDAC handler)
before releasing the gen_pool.
The gen_pool free function differs from the standard
memory free prototype(requires a size parameter) which necessitated
changing the generic free function pointer in altera_edac.h and
the prototypes for the memory free function in altera_ecc_l2.c.

V2:
Fix warnings when debugging is disabled.

V3:
Remove stray newlines in altera_ecc_mgr_edac.c & altera_ecc_ocram.c

Signed-off-by: Thor Thayer <tthayer@altera.com>