Re: [PATCH] [v8] net: emac: emac gigabit ethernet controller driver

2016-08-25 Thread Timur Tabi

Florian Fainelli wrote:

>>Since you have a check on CONFIG_QCOM_EMAC in emac/Makefile, you could
>>always recurse into that directory while building (use obj-y).

>
>Obviously, having "obj-$(CONFIG_QCOM_EMAC)" in both Makefiles is
>redundant, but wouldn't it make more sense to change
>"obj-$(CONFIG_QCOM_EMAC)" to "obj-y" in
>drivers/net/ethernet/qualcomm/emac/Makefile, so that I only recurse if
>necessary?



Whichever makes the most sense, when there is a directory involved, my
preference is to always recurse in that directory and selectively
compile from there, since the Kconfig/Makefile options are all located
within the same hierarchical level, just a preference.


It turns out that the way I changed it in v9 prevents the driver from 
being built as a module.  I changed the wrong Makefile.  I will have to 
post a v10.


--
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm
Technologies, Inc.  Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.


Re: [PATCH] [v8] net: emac: emac gigabit ethernet controller driver

2016-08-17 Thread Andrew Lunn
> Something is odd about of_mdiobus_register().
> 
> This function scans child nodes to look for PHYs:
> 
> /* Loop over the child nodes and register a phy_device for each phy */
> for_each_available_child_of_node(np, child) {
>   addr = of_mdio_parse_addr(>dev, child);
> 
> And in my driver, this works.  However, later when I try to call
> of_phy_find_device(), it fails.  That's because of_phy_find_device()
> wants the np of the child node.  But the only way to get that is
> with a phy-phandle property which I need to manually parse.

You do need the phy-handle, because you can have multiple PHYs, and
ethernet switches on the MDIO bus. You need to indicate which of those
PHYs is connected to this MAC.

> So what's the point of having of_mdiobus_register() parse child
> nodes, if you need a phy-phandle pointer anyway?

So we know about the other phys and switches on the MDIO bus, can load
the driver for them, etc. This is standard policy for a bus
driver. When you instantiate the bus, you enumerate it to see what is
connected to it. You do that either with of_mdiobus_register() or
mdiobus_register().

However, i do agree about having a helper do the phy-handle parsing
would be nice, and it should also handle fixed phys as well.

  Andrew


Re: [PATCH] [v8] net: emac: emac gigabit ethernet controller driver

2016-08-17 Thread Florian Fainelli
On 08/17/2016 12:38 PM, Timur Tabi wrote:
>> If this is an external PHY, the expectation is that it will be hanging
>> off a MDIO bus controller, either the MDIO bus internal to the MAC, or
>> an external MDIO bus (separate register range).
> 
> So for starters, I forgot to delete the 'compatible' property from this
> document.  Its presence breaks of_mdiobus_child_is_phy().

The MDIO devices and Ethernet PHY binding should certainly be improved,
but the bulk of it is either you use ethernet-phy-ieee802.3-c22 or
ethernet-phy-ieee802.3-c45, or nothing. Else, the MDIO bus probing code
just assumes it can match a MDIO device (not specifically an Ethernet
PHY) with its compatible string.

> 
>> If such a PHY node is provided, the expectation is that your Ethernet
>> MAC will have a phy-handle property and a phy-mode property to specify
>> how to connect to this external PHY, so in your specific case, better
>> remove the PHY from your example, or detail further how it should be
>> done.
> 
> Something is odd about of_mdiobus_register().
> 
> This function scans child nodes to look for PHYs:
> 
> /* Loop over the child nodes and register a phy_device for each phy */
> for_each_available_child_of_node(np, child) {
> addr = of_mdio_parse_addr(>dev, child);
> 
> And in my driver, this works.  However, later when I try to call
> of_phy_find_device(), it fails.  That's because of_phy_find_device()
> wants the np of the child node.  But the only way to get that is with a
> phy-phandle property which I need to manually parse.

of_get_phandle() should return the device_node pointer associated with
the phy-handle property which you can later use and pass to
of_phy_find_device(). There are plenty of examples in the tree and the
logic is almost always the same.

> 
> So what's the point of having of_mdiobus_register() parse child nodes,
> if you need a phy-phandle pointer anyway?

Not all MDIO devices are Ethernet PHYs, some of them are Ethernet
switches, or any other PHY (USB, PCIE, SATA) just sitting on the same
MDIO bus HW instance so you need to create device_node and struct device
instances for these deviecs listed in the Device Tree since the bus is
self-discoverable (like I2C).

Your Ethernet controller somehow needs to know which Ethernet PHY it is
attached to since the location of the Ethernet PHY on the bus could
change from design to design, let alone the actual topology (you could
have a GPIO bit-banged MDIO bus or something else).

>> Since you have a check on CONFIG_QCOM_EMAC in emac/Makefile, you could
>> always recurse into that directory while building (use obj-y).
> 
> Obviously, having "obj-$(CONFIG_QCOM_EMAC)" in both Makefiles is
> redundant, but wouldn't it make more sense to change
> "obj-$(CONFIG_QCOM_EMAC)" to "obj-y" in
> drivers/net/ethernet/qualcomm/emac/Makefile, so that I only recurse if
> necessary?

Whichever makes the most sense, when there is a directory involved, my
preference is to always recurse in that directory and selectively
compile from there, since the Kconfig/Makefile options are all located
within the same hierarchical level, just a preference.

> 
>>> >+static void emac_adjust_link(struct net_device *netdev)
>>> >+{
>>> >+struct emac_adapter *adpt = netdev_priv(netdev);
>>> >+struct phy_device *phydev = netdev->phydev;
>>> >+
>>> >+if (phydev->link)
>>> >+emac_mac_start(adpt);
>>> >+else
>>> >+emac_mac_stop(adpt);
> 
>> This is really excessive here, you typically don't need to completely
>> stop your transmitter/receiver/DMA/what have you, just reprogram the MAC
>> with the appropriate link speed/duplex/pause parameters.
> 
> Yes, I realize that a lot of the reinit code in my driver is "heavy",
> and that it could be optimized for specific situations.  However, I'd
> like to save that for another patch, because it would require me to
> study the documentation and do extensive tests.
> 
> I can't tell you today whether emac_mac_start() is overkill for the
> specific link change.  For all I know, the hardware does require the TX
> to stop before changing the link speed.  Remember, the EMAC does have a
> weird double-phy (one internal, one external).

Fair enough, not having to stop the TX from the SW perspective should be
kind of basic requirement here, most drivers/HW don't seem to require
that, because even if packets were inflight at the time the link went
down, the MAC should sense the carrier loss and report that accordingly.
Now there could be many different ways to implement and screw that up,
so yes, future patch seems like a good approach.
-- 
Florian


Re: [PATCH] [v8] net: emac: emac gigabit ethernet controller driver

2016-08-17 Thread Timur Tabi

Florian Fainelli wrote:

On 08/11/2016 02:34 PM, Timur Tabi wrote:

>Add supports for ethernet controller HW on Qualcomm Technologies, Inc. SoC.
>This driver supports the following features:
>1) Checksum offload.
>2) Interrupt coalescing support.
>3) SGMII phy.
>4) phylib interface for external phy



OK, so this is looking good now, just a few nits, feel free to submit as
clean up patches, would this one be accepted.


I will post a v9.


>+soc {
>+   #address-cells = <1>;
>+   #size-cells = <1>;
>+   dma-ranges = <0 0 0x>;
>+
>+   emac0: ethernet@feb2 {
>+   compatible = "qcom,fsm9900-emac";
>+   #address-cells = <1>;
>+   #size-cells = <1>;
>+   reg-names = "base", "csr", "ptp", "sgmii";
>+   reg =   <0xfeb2 0x1>,
>+   <0xfeb36000 0x1000>,
>+   <0xfeb3c000 0x4000>,
>+   <0xfeb38000 0x400>;
>+   interrupt-parent = <>;
>+   #interrupt-cells = <1>;
>+   interrupts = <76 80>;
>+   interrupt-names = "emac_core0", "sgmii_irq";
>+   phy0: ethernet-phy@0 {
>+   compatible = "qcom,fsm9900-emac-phy";
>+   reg = <0>;
>+   }



If this is an external PHY, the expectation is that it will be hanging
off a MDIO bus controller, either the MDIO bus internal to the MAC, or
an external MDIO bus (separate register range).


So for starters, I forgot to delete the 'compatible' property from this 
document.  Its presence breaks of_mdiobus_child_is_phy().



If such a PHY node is provided, the expectation is that your Ethernet
MAC will have a phy-handle property and a phy-mode property to specify
how to connect to this external PHY, so in your specific case, better
remove the PHY from your example, or detail further how it should be done.


Something is odd about of_mdiobus_register().

This function scans child nodes to look for PHYs:

/* Loop over the child nodes and register a phy_device for each phy */
for_each_available_child_of_node(np, child) {
addr = of_mdio_parse_addr(>dev, child);

And in my driver, this works.  However, later when I try to call 
of_phy_find_device(), it fails.  That's because of_phy_find_device() 
wants the np of the child node.  But the only way to get that is with a 
phy-phandle property which I need to manually parse.


So what's the point of having of_mdiobus_register() parse child nodes, 
if you need a phy-phandle pointer anyway?



>diff --git a/drivers/net/ethernet/qualcomm/Kconfig 
b/drivers/net/ethernet/qualcomm/Kconfig
>index a76e380..85b599f 100644
>--- a/drivers/net/ethernet/qualcomm/Kconfig
>+++ b/drivers/net/ethernet/qualcomm/Kconfig
>@@ -24,4 +24,15 @@ config QCA7000
>  To compile this driver as a module, choose M here. The module
>  will be called qcaspi.
>
>+config QCOM_EMAC
>+   tristate "Qualcomm Technologies, Inc. EMAC Gigabit Ethernet support"
>+   select CRC32



select PHYLIB?


Ok.


>diff --git a/drivers/net/ethernet/qualcomm/Makefile 
b/drivers/net/ethernet/qualcomm/Makefile
>index 9da2d75..1b3a0ce 100644
>--- a/drivers/net/ethernet/qualcomm/Makefile
>+++ b/drivers/net/ethernet/qualcomm/Makefile
>@@ -4,3 +4,5 @@
>
>  obj-$(CONFIG_QCA7000) += qcaspi.o
>  qcaspi-objs := qca_spi.o qca_framing.o qca_7k.o qca_debug.o
>+
>+obj-$(CONFIG_QCOM_EMAC) += emac/



Since you have a check on CONFIG_QCOM_EMAC in emac/Makefile, you could
always recurse into that directory while building (use obj-y).


Obviously, having "obj-$(CONFIG_QCOM_EMAC)" in both Makefiles is 
redundant, but wouldn't it make more sense to change 
"obj-$(CONFIG_QCOM_EMAC)" to "obj-y" in 
drivers/net/ethernet/qualcomm/emac/Makefile, so that I only recurse if 
necessary?



>+static void emac_adjust_link(struct net_device *netdev)
>+{
>+   struct emac_adapter *adpt = netdev_priv(netdev);
>+   struct phy_device *phydev = netdev->phydev;
>+
>+   if (phydev->link)
>+   emac_mac_start(adpt);
>+   else
>+   emac_mac_stop(adpt);



This is really excessive here, you typically don't need to completely
stop your transmitter/receiver/DMA/what have you, just reprogram the MAC
with the appropriate link speed/duplex/pause parameters.


Yes, I realize that a lot of the reinit code in my driver is "heavy", 
and that it could be optimized for specific situations.  However, I'd 
like to save that for another patch, because it would require me to 
study the documentation and do extensive tests.


I can't tell you today whether emac_mac_start() is overkill for the 
specific link change.  For all I know, the hardware does require the TX 
to stop before changing the link speed.  Remember, the EMAC does have a 
weird double-phy (one internal, one external).


--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the
Code Aurora Forum, hosted by The Linux Foundation.


Re: Aw: [PATCH] [v8] net: emac: emac gigabit ethernet controller driver

2016-08-12 Thread Timur Tabi

Lino Sanfilippo wrote:

You can either extend the refill function by one gfp_t parameter and then call 
it
with GFP_KERNEL for the initial rx buffer allocation when the hw is brought up 
and
then with GFP_ATOMIC for refilling in the NAPI handler. Or simply always use 
GFP_ATOMIC.
In the latter case the additional parameter is not needed of course and you can
use netdev_alloc_skb_ip_align() instead of __netdev_alloc_skb_ip_align().


I will change this to use netdev_alloc_skb_ip_align().

Thanks.

--
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm
Technologies, Inc.  Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.


Aw: [PATCH] [v8] net: emac: emac gigabit ethernet controller driver

2016-08-12 Thread Lino Sanfilippo
Hi,

I really dont want to be a killjoy, but...

> + int ret;
> +
> + skb = __netdev_alloc_skb_ip_align(adpt->netdev,
> +   adpt->rxbuf_size, GFP_KERNEL);

This is also called in softirq context by the napi handler in which GFP_KERNEL 
is
not allowed.
You can either extend the refill function by one gfp_t parameter and then call 
it 
with GFP_KERNEL for the initial rx buffer allocation when the hw is brought up 
and 
then with GFP_ATOMIC for refilling in the NAPI handler. Or simply always use 
GFP_ATOMIC.
In the latter case the additional parameter is not needed of course and you can
use netdev_alloc_skb_ip_align() instead of __netdev_alloc_skb_ip_align().

Regards,
Lino



Re: [PATCH] [v8] net: emac: emac gigabit ethernet controller driver

2016-08-12 Thread Rob Herring
On Thu, Aug 11, 2016 at 04:34:05PM -0500, Timur Tabi wrote:
> Add supports for ethernet controller HW on Qualcomm Technologies, Inc. SoC.
> This driver supports the following features:
> 1) Checksum offload.
> 2) Interrupt coalescing support.
> 3) SGMII phy.
> 4) phylib interface for external phy
> 
> Based on original work by
>   Niranjana Vishwanathapura 
>   Gilad Avidov 
> 
> Signed-off-by: Timur Tabi 
> ---
> 
> v8:
>  - Remove "phy-version" property, use different compatible strings to
>differentiate EMAC versions instead.
>  - fully unmap all DMA mappings upon any single DMA mapping error
>  - add support for 32-bit DMA masks
>  - Make reads/writes to hardware data structures endian-safe
>  - emac_mac_stop already disables interrupts, so don't do it in emac_mac_reset
>  - Set adpt->rxbuf_size only when initializing the MAC, not when changing MTU
>  - Fix the calculation of the # of free descriptors required
>  - Always stop the PHY before disconnecting it
>  - Miscellaneous cleanups (removing unused definitions, fix typos and spacing,
>use unsized ints, etc).
> 
> v7:
>  - add "phy-version" to DT docs
>  - remove emac_status_bits, use mutexes instead of polling a status bit
>  - test return code from dma_map_single() calls
>  - use __netdev_alloc_skb_ip_align instead of dev_alloc_skb
>  - add a missing free_irq on an error path
>  - return an error code from emac_reinit_locked
>  - support setting the MTU even when the interface is down
>  - use a spinlock not a mutex in emac_get_stats64
>  - don't redundantly set the ethernet device name
>  - remove all hardware timestamp code, since it's incomplete
>  - remove redundant 'reset' param to emac_mac_down()
>  - handle queue throttling properly
> 
> v6:
>  - Properly ordered local variables
>  - use built-in GEN_MASK instead of BITS_MASK
>  - remove redundant call to emac_rx_mode_set from emac_mac_up
>  - removed emac_rfd structure, use dma_addr_t directly instead
>  - removed emac_mac_speed enun, replaced with macros
>  - removed superfluous phy_stop from emac_mac_down(), which prevented 
> reloading module
>  - add missing netif_napi_del
>  - set the DMA mask
> 
> v5:
>  - changed author to Timur, added MAINTAINERS entry
>  - use phylib, replacing internal phy code
>  - added support for EMAC internal SGMII v2
>  - fix ~DIS_INT warning
>  - update DT bindings, including removing unused properties
>  - removed interrupt handler for internal sgmii
>  - removed link status check handler/state (replaced with phylib)
>  - removed periodic timer handler (replaced with phylib)
>  - removed power management code (will be rewritten later)
>  - external phy is now required, not optional
>  - removed redundant EMAC_STATUS_DOWN status flag
>  - removed redundant link status and speed variables
>  - removed redundant status bits (vlan strip, promiscuous, loopback, etc)
>  - removed useless watchdog status
>  - removed command-line parameters
>  - cleaned up probe messages
>  - removed redundant params from emac_sgmii_link_init()
>  - always call netdev_completed_queue() (per review comment)
>  - fix emac_napi_rtx() (per review comment)
>  - removed max_ints loop in interrupt handler
>  - removed redundant mutex around phy read/write calls
>  - added lock for reading emac status (per review comment)
>  - generate random MAC address if it can't be read from firmware
>  - replace EMAC_DMA_ADDR_HI/LO with upper/lower_32_bits
>  - don't test return value from platform_get_resource (per review comment)
>  - use net_warn_ratelimited (per review comment)
>  - don't set the dma masks (will be set by DT or IORT code)
>  - remove unused emac_tx_tpd_ts_save()
>  - removed redundant local MTU variable
> 
> v4:
>  - add missing ipv6 header file
>  - correct compatible string
>  - fix spacing in emac_reg_write arrays
>  - drop unnecessary cell-index property
>  - remove unsupported DT properties from docs
>  - remove GPIO initialization and update docs
> 
> v3:
>  - remove most of the memory barriers by using the non xxx_relaxed() api.
>  - remove RSS and WOL support.
>  - correct comments from physical address to dma address.
>  - rearrange structs to make them packed.
>  - replace polling loops with readl_poll_timeout().
>  - remove unnecessary wrapper functions from phy layer.
>  - add blank line before return statements.
>  - set to null clocks after clk_put().
>  - use module_platform_driver() and dma_set_mask_and_coherent()
>  - replace long hex bitmasks with BIT() macro.
> 
> v2:
>  - replace hw bit fields to macros with bitwise operations.
>  - change all iterators to unsized types (int)
>  - some minor code flow improvements.
>  - change return type to void for functions which return value is never
>used.
>  - replace instance of l_relaxed() io followed by mb() with a
>readl()/writel().
> 
>  .../devicetree/bindings/net/qcom-emac.txt  |   64 +

Acked-by: Rob 

Re: [PATCH] [v8] net: emac: emac gigabit ethernet controller driver

2016-08-11 Thread Florian Fainelli
On 08/11/2016 02:34 PM, Timur Tabi wrote:
> Add supports for ethernet controller HW on Qualcomm Technologies, Inc. SoC.
> This driver supports the following features:
> 1) Checksum offload.
> 2) Interrupt coalescing support.
> 3) SGMII phy.
> 4) phylib interface for external phy

OK, so this is looking good now, just a few nits, feel free to submit as
clean up patches, would this one be accepted.

[snip]

> +Example:
> +soc {
> + #address-cells = <1>;
> + #size-cells = <1>;
> + dma-ranges = <0 0 0x>;
> +
> + emac0: ethernet@feb2 {
> + compatible = "qcom,fsm9900-emac";
> + #address-cells = <1>;
> + #size-cells = <1>;
> + reg-names = "base", "csr", "ptp", "sgmii";
> + reg =   <0xfeb2 0x1>,
> + <0xfeb36000 0x1000>,
> + <0xfeb3c000 0x4000>,
> + <0xfeb38000 0x400>;
> + interrupt-parent = <>;
> + #interrupt-cells = <1>;
> + interrupts = <76 80>;
> + interrupt-names = "emac_core0", "sgmii_irq";
> + phy0: ethernet-phy@0 {
> + compatible = "qcom,fsm9900-emac-phy";
> + reg = <0>;
> + }

If this is an external PHY, the expectation is that it will be hanging
off a MDIO bus controller, either the MDIO bus internal to the MAC, or
an external MDIO bus (separate register range).

If such a PHY node is provided, the expectation is that your Ethernet
MAC will have a phy-handle property and a phy-mode property to specify
how to connect to this external PHY, so in your specific case, better
remove the PHY from your example, or detail further how it should be done.

> +
> + pinctrl-names = "default";
> + pinctrl-0 = <_pins_a>;
> + };
> +
> + tlmm: pinctrl@fd51 {
> + compatible = "qcom,fsm9900-pinctrl";
> +
> + mdio_pins_a: mdio {
> + state {
> + pins = "gpio123", "gpio124";
> + function = "mdio";
> + };
> + };
> + };
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 952fd2a..38dabdf 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -9404,6 +9404,12 @@ T: git 
> git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git
>  S:   Supported
>  F:   drivers/net/wireless/ath/ath10k/
>  
> +QUALCOMM EMAC GIGABIT ETHERNET DRIVER
> +M:   Timur Tabi 
> +L:   netdev@vger.kernel.org
> +S:   Supported
> +F:   drivers/net/ethernet/qualcomm/emac/
> +
>  QUALCOMM HEXAGON ARCHITECTURE
>  M:   Richard Kuo 
>  L:   linux-hexa...@vger.kernel.org
> diff --git a/drivers/net/ethernet/qualcomm/Kconfig 
> b/drivers/net/ethernet/qualcomm/Kconfig
> index a76e380..85b599f 100644
> --- a/drivers/net/ethernet/qualcomm/Kconfig
> +++ b/drivers/net/ethernet/qualcomm/Kconfig
> @@ -24,4 +24,15 @@ config QCA7000
> To compile this driver as a module, choose M here. The module
> will be called qcaspi.
>  
> +config QCOM_EMAC
> + tristate "Qualcomm Technologies, Inc. EMAC Gigabit Ethernet support"
> + select CRC32

select PHYLIB?

> + ---help---
> +   This driver supports the Qualcomm Technologies, Inc. Gigabit
> +   Ethernet Media Access Controller (EMAC). The controller
> +   supports IEEE 802.3-2002, half-duplex mode at 10/100 Mb/s,
> +   full-duplex mode at 10/100/1000Mb/s, Wake On LAN (WOL) for
> +   low power, Receive-Side Scaling (RSS), and IEEE 1588-2008
> +   Precision Clock Synchronization Protocol.
> +
>  endif # NET_VENDOR_QUALCOMM
> diff --git a/drivers/net/ethernet/qualcomm/Makefile 
> b/drivers/net/ethernet/qualcomm/Makefile
> index 9da2d75..1b3a0ce 100644
> --- a/drivers/net/ethernet/qualcomm/Makefile
> +++ b/drivers/net/ethernet/qualcomm/Makefile
> @@ -4,3 +4,5 @@
>  
>  obj-$(CONFIG_QCA7000) += qcaspi.o
>  qcaspi-objs := qca_spi.o qca_framing.o qca_7k.o qca_debug.o
> +
> +obj-$(CONFIG_QCOM_EMAC) += emac/

Since you have a check on CONFIG_QCOM_EMAC in emac/Makefile, you could
always recurse into that directory while building (use obj-y).

> diff --git a/drivers/net/ethernet/qualcomm/emac/Makefile 
> b/drivers/net/ethernet/qualcomm/emac/Makefile
> new file mode 100644
> index 000..01ee144
> --- /dev/null
> +++ b/drivers/net/ethernet/qualcomm/emac/Makefile
> @@ -0,0 +1,7 @@
> +#
> +# Makefile for the Qualcomm Technologies, Inc. EMAC Gigabit Ethernet driver
> +#
> +
> +obj-$(CONFIG_QCOM_EMAC) += qcom-emac.o

[snip]

> +
> +static void emac_adjust_link(struct net_device *netdev)
> +{
> + struct emac_adapter *adpt = netdev_priv(netdev);
> + struct phy_device *phydev = netdev->phydev;
> +
> + if (phydev->link)
> + emac_mac_start(adpt);
> + else
> + emac_mac_stop(adpt);

This is really excessive here, you typically don't need to completely
stop your transmitter/receiver/DMA/what 

[PATCH] [v8] net: emac: emac gigabit ethernet controller driver

2016-08-11 Thread Timur Tabi
Add supports for ethernet controller HW on Qualcomm Technologies, Inc. SoC.
This driver supports the following features:
1) Checksum offload.
2) Interrupt coalescing support.
3) SGMII phy.
4) phylib interface for external phy

Based on original work by
Niranjana Vishwanathapura 
Gilad Avidov 

Signed-off-by: Timur Tabi 
---

v8:
 - Remove "phy-version" property, use different compatible strings to
   differentiate EMAC versions instead.
 - fully unmap all DMA mappings upon any single DMA mapping error
 - add support for 32-bit DMA masks
 - Make reads/writes to hardware data structures endian-safe
 - emac_mac_stop already disables interrupts, so don't do it in emac_mac_reset
 - Set adpt->rxbuf_size only when initializing the MAC, not when changing MTU
 - Fix the calculation of the # of free descriptors required
 - Always stop the PHY before disconnecting it
 - Miscellaneous cleanups (removing unused definitions, fix typos and spacing,
   use unsized ints, etc).

v7:
 - add "phy-version" to DT docs
 - remove emac_status_bits, use mutexes instead of polling a status bit
 - test return code from dma_map_single() calls
 - use __netdev_alloc_skb_ip_align instead of dev_alloc_skb
 - add a missing free_irq on an error path
 - return an error code from emac_reinit_locked
 - support setting the MTU even when the interface is down
 - use a spinlock not a mutex in emac_get_stats64
 - don't redundantly set the ethernet device name
 - remove all hardware timestamp code, since it's incomplete
 - remove redundant 'reset' param to emac_mac_down()
 - handle queue throttling properly

v6:
 - Properly ordered local variables
 - use built-in GEN_MASK instead of BITS_MASK
 - remove redundant call to emac_rx_mode_set from emac_mac_up
 - removed emac_rfd structure, use dma_addr_t directly instead
 - removed emac_mac_speed enun, replaced with macros
 - removed superfluous phy_stop from emac_mac_down(), which prevented reloading 
module
 - add missing netif_napi_del
 - set the DMA mask

v5:
 - changed author to Timur, added MAINTAINERS entry
 - use phylib, replacing internal phy code
 - added support for EMAC internal SGMII v2
 - fix ~DIS_INT warning
 - update DT bindings, including removing unused properties
 - removed interrupt handler for internal sgmii
 - removed link status check handler/state (replaced with phylib)
 - removed periodic timer handler (replaced with phylib)
 - removed power management code (will be rewritten later)
 - external phy is now required, not optional
 - removed redundant EMAC_STATUS_DOWN status flag
 - removed redundant link status and speed variables
 - removed redundant status bits (vlan strip, promiscuous, loopback, etc)
 - removed useless watchdog status
 - removed command-line parameters
 - cleaned up probe messages
 - removed redundant params from emac_sgmii_link_init()
 - always call netdev_completed_queue() (per review comment)
 - fix emac_napi_rtx() (per review comment)
 - removed max_ints loop in interrupt handler
 - removed redundant mutex around phy read/write calls
 - added lock for reading emac status (per review comment)
 - generate random MAC address if it can't be read from firmware
 - replace EMAC_DMA_ADDR_HI/LO with upper/lower_32_bits
 - don't test return value from platform_get_resource (per review comment)
 - use net_warn_ratelimited (per review comment)
 - don't set the dma masks (will be set by DT or IORT code)
 - remove unused emac_tx_tpd_ts_save()
 - removed redundant local MTU variable

v4:
 - add missing ipv6 header file
 - correct compatible string
 - fix spacing in emac_reg_write arrays
 - drop unnecessary cell-index property
 - remove unsupported DT properties from docs
 - remove GPIO initialization and update docs

v3:
 - remove most of the memory barriers by using the non xxx_relaxed() api.
 - remove RSS and WOL support.
 - correct comments from physical address to dma address.
 - rearrange structs to make them packed.
 - replace polling loops with readl_poll_timeout().
 - remove unnecessary wrapper functions from phy layer.
 - add blank line before return statements.
 - set to null clocks after clk_put().
 - use module_platform_driver() and dma_set_mask_and_coherent()
 - replace long hex bitmasks with BIT() macro.

v2:
 - replace hw bit fields to macros with bitwise operations.
 - change all iterators to unsized types (int)
 - some minor code flow improvements.
 - change return type to void for functions which return value is never
   used.
 - replace instance of l_relaxed() io followed by mb() with a
   readl()/writel().

 .../devicetree/bindings/net/qcom-emac.txt  |   64 +
 MAINTAINERS|6 +
 drivers/net/ethernet/qualcomm/Kconfig  |   11 +
 drivers/net/ethernet/qualcomm/Makefile |2 +
 drivers/net/ethernet/qualcomm/emac/Makefile|7 +
 drivers/net/ethernet/qualcomm/emac/emac-mac.c  |