xref: /qemu/include/hw/net/msf2-emac.h (revision fc524567087c2537b5103cdfc1d41e4f442892b6)
11c664378SSubbaraya Sundeep /*
21c664378SSubbaraya Sundeep  * QEMU model of the Smartfusion2 Ethernet MAC.
31c664378SSubbaraya Sundeep  *
41c664378SSubbaraya Sundeep  * Copyright (c) 2020 Subbaraya Sundeep <sundeep.lkml@gmail.com>.
51c664378SSubbaraya Sundeep  *
61c664378SSubbaraya Sundeep  * Permission is hereby granted, free of charge, to any person obtaining a copy
71c664378SSubbaraya Sundeep  * of this software and associated documentation files (the "Software"), to deal
81c664378SSubbaraya Sundeep  * in the Software without restriction, including without limitation the rights
91c664378SSubbaraya Sundeep  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
101c664378SSubbaraya Sundeep  * copies of the Software, and to permit persons to whom the Software is
111c664378SSubbaraya Sundeep  * furnished to do so, subject to the following conditions:
121c664378SSubbaraya Sundeep  *
131c664378SSubbaraya Sundeep  * The above copyright notice and this permission notice shall be included in
141c664378SSubbaraya Sundeep  * all copies or substantial portions of the Software.
151c664378SSubbaraya Sundeep  *
161c664378SSubbaraya Sundeep  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
171c664378SSubbaraya Sundeep  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
181c664378SSubbaraya Sundeep  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
191c664378SSubbaraya Sundeep  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
201c664378SSubbaraya Sundeep  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
211c664378SSubbaraya Sundeep  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
221c664378SSubbaraya Sundeep  * THE SOFTWARE.
231c664378SSubbaraya Sundeep  */
241c664378SSubbaraya Sundeep 
251c664378SSubbaraya Sundeep #include "hw/sysbus.h"
26*8be545baSRichard Henderson #include "system/memory.h"
271c664378SSubbaraya Sundeep #include "net/net.h"
281c664378SSubbaraya Sundeep #include "net/eth.h"
29db1015e9SEduardo Habkost #include "qom/object.h"
301c664378SSubbaraya Sundeep 
311c664378SSubbaraya Sundeep #define TYPE_MSS_EMAC "msf2-emac"
328063396bSEduardo Habkost OBJECT_DECLARE_SIMPLE_TYPE(MSF2EmacState, MSS_EMAC)
331c664378SSubbaraya Sundeep 
341c664378SSubbaraya Sundeep #define R_MAX         (0x1a0 / 4)
351c664378SSubbaraya Sundeep #define PHY_MAX_REGS  32
361c664378SSubbaraya Sundeep 
37db1015e9SEduardo Habkost struct MSF2EmacState {
381c664378SSubbaraya Sundeep     SysBusDevice parent;
391c664378SSubbaraya Sundeep 
401c664378SSubbaraya Sundeep     MemoryRegion mmio;
411c664378SSubbaraya Sundeep     MemoryRegion *dma_mr;
421c664378SSubbaraya Sundeep     AddressSpace dma_as;
431c664378SSubbaraya Sundeep 
441c664378SSubbaraya Sundeep     qemu_irq irq;
451c664378SSubbaraya Sundeep     NICState *nic;
461c664378SSubbaraya Sundeep     NICConf conf;
471c664378SSubbaraya Sundeep 
481c664378SSubbaraya Sundeep     uint8_t mac_addr[ETH_ALEN];
491c664378SSubbaraya Sundeep     uint32_t rx_desc;
501c664378SSubbaraya Sundeep     uint16_t phy_regs[PHY_MAX_REGS];
511c664378SSubbaraya Sundeep 
521c664378SSubbaraya Sundeep     uint32_t regs[R_MAX];
53db1015e9SEduardo Habkost };
54