freebsd/if_cpsw: Port.

This commit is contained in:
Christian Mauderer 2018-12-19 22:53:54 +01:00 committed by Sebastian Huber
parent 736d651892
commit 8ae22c48b3
4 changed files with 26 additions and 0 deletions

View File

@ -375,6 +375,11 @@ cpsw_debugf(const char *fmt, ...)
#define cpsw_cpdma_bd_offset(i) (CPSW_CPPI_RAM_OFFSET + ((i)*16))
#ifdef __rtems__
/* Missing in the bus.h provided by rtems. */
#define BUS_SPACE_PHYSADDR(res, offs) \
((u_int)(rman_get_start(res)+(offs)))
#endif /* __rtems__ */
#define cpsw_cpdma_bd_paddr(sc, slot) \
BUS_SPACE_PHYSADDR(sc->mem_res, slot->bd_offset)
#define cpsw_cpdma_read_bd(sc, slot, val) \
@ -1751,7 +1756,9 @@ cpsw_rx_enqueue(struct cpsw_softc *sc)
break;
}
#ifndef __rtems__
bus_dmamap_sync(sc->mbuf_dtag, slot->dmamap, BUS_DMASYNC_PREREAD);
#endif /* __rtems__ */
/* Create and submit new rx descriptor. */
if ((next = STAILQ_NEXT(slot, next)) != NULL)
@ -1763,6 +1770,10 @@ cpsw_rx_enqueue(struct cpsw_softc *sc)
bd.buflen = MCLBYTES - 1;
bd.pktlen = bd.buflen;
bd.flags = CPDMA_BD_OWNER;
#ifdef __rtems__
rtems_cache_invalidate_multiple_data_lines(
seg->ds_addr, bd.buflen);
#endif /* __rtems__ */
cpsw_cpdma_write_bd(sc, slot, &bd);
++added;
@ -1876,8 +1887,10 @@ cpswp_tx_enqueue(struct cpswp_softc *sc)
break;
}
#ifndef __rtems__
bus_dmamap_sync(sc->swsc->mbuf_dtag, slot->dmamap,
BUS_DMASYNC_PREWRITE);
#endif /* __rtems__ */
CPSW_DEBUGF(sc->swsc,
("Queueing TX packet: %d segments + %d pad bytes",
@ -1910,6 +1923,10 @@ cpswp_tx_enqueue(struct cpswp_softc *sc)
bd.flags |= CPDMA_BD_TO_PORT;
bd.flags |= ((sc->unit + 1) & CPDMA_BD_PORT_MASK);
}
#ifdef __rtems__
rtems_cache_flush_multiple_data_lines((void *)segs[0].ds_addr,
segs[0].ds_len);
#endif /* __rtems__ */
for (seg = 1; seg < nsegs; ++seg) {
/* Save the previous buffer (which isn't EOP) */
cpsw_cpdma_write_bd(sc->swsc, slot, &bd);
@ -1928,6 +1945,10 @@ cpswp_tx_enqueue(struct cpswp_softc *sc)
bd.buflen = segs[seg].ds_len;
bd.pktlen = 0;
bd.flags = CPDMA_BD_OWNER;
#ifdef __rtems__
rtems_cache_flush_multiple_data_lines(
(void *)segs[seg].ds_addr, segs[seg].ds_len);
#endif /* __rtems__ */
}
/* Save the final buffer. */

View File

@ -1335,6 +1335,8 @@ class dev_net(builder.Module):
mm = self.manager
self.addKernelSpaceHeaderFiles(
[
'sys/arm/ti/cpsw/if_cpswreg.h',
'sys/arm/ti/cpsw/if_cpswvar.h',
'sys/arm/xilinx/zy7_slcr.h',
'sys/dev/cadence/if_cgem_hw.h',
'sys/dev/dwc/if_dwc.h',
@ -1367,6 +1369,7 @@ class dev_net(builder.Module):
)
self.addKernelSpaceSourceFiles(
[
'sys/arm/ti/cpsw/if_cpsw.c',
'sys/dev/ffec/if_ffec.c',
'sys/dev/mii/mii.c',
'sys/dev/mii/mii_bitbang.c',

View File

@ -59,6 +59,8 @@ SYSINIT_DRIVER_REFERENCE(usbss, simplebus);
SYSINIT_DRIVER_REFERENCE(musbotg, usbss);
SYSINIT_DRIVER_REFERENCE(sdhci_ti, simplebus);
SYSINIT_DRIVER_REFERENCE(mmcsd, mmc);
SYSINIT_DRIVER_REFERENCE(cpsw, cpswss);
SYSINIT_DRIVER_REFERENCE(ukphy, miibus);
#ifdef RTEMS_BSD_MODULE_NET80211
SYSINIT_DRIVER_REFERENCE(rtwn_usb, uhub);
SYSINIT_MODULE_REFERENCE(wlan_ratectl_none);