[PATCH] RTEMS libbsd changes for cpsw driver

Gedare Bloom gedare at gwu.edu
Mon Jun 29 13:48:03 UTC 2015


Out of curiousity, would upstream freebsd be likely interested in
using the nexus instead of simplebus? That is, should some of this be
commited upstream? Few comments below.

On Sun, Jun 28, 2015 at 5:58 AM, ragunath <ragunath3252 at gmail.com> wrote:
> ---
> @@ -326,6 +342,13 @@ cpsw_debugf(const char *fmt, ...)
>   */
>  #define        cpsw_read_4(sc, reg)            bus_read_4(sc->res[0], reg)
>  #define        cpsw_write_4(sc, reg, val)      bus_write_4(sc->res[0], reg, val)
> +#ifdef __rtems__
> +#define BUS_SPACE_PHYSADDR(res, offs) \
> +        ((u_int)(rman_get_start(res)+(offs)))
> +#define cm_read(a)    (*(volatile uint32_t *)(a))
> +#define cm_write(a,v) (*(volatile uint32_t *)(a) = (v))
> +#endif /* __rtems__ */
> +
>
Watch out for changes outside of the ifdef guards.

> @@ -551,14 +576,18 @@ cpsw_attach(device_t dev)
>         struct cpsw_softc *sc = device_get_softc(dev);
>         struct mii_softc *miisc;
>         struct ifnet *ifp;
> +#ifndef __rtems__
>         void *phy_sc;
> -       int error, phy, nsegs;
> +       int phy;
> +#endif /* __rtems__ */
> +       int error, nsegs;

Also here, you probably should keep the original block of code, but
use an #else to define the latter condition..
#ifndef __rtems__
  void *phy_sc;
  int error, phy, nsegs;
#else
  int error, nsegs;
#endif /* __rtems__ */

-Gedare



More information about the devel mailing list