Beispiel #1
0
/*
 * Attach an SMC91111 driver to the system
 */
int
rtems_smc91111_driver_attach_leon3 (struct rtems_bsdnet_ifconfig *config,
				    int attach)
{
  unsigned long addr_mctrl = 0;
  struct grgpio_regs *io;
  struct ambapp_apb_info apbpio;
  struct ambapp_apb_info apbmctrl;

  if (ambapp_find_apbslv(&ambapp_plb, VENDOR_GAISLER, GAISLER_GPIO, &apbpio)
      != 1) {
    printk("SMC9111_leon3: didn't find PIO\n");
    return 0;
  }

  /* In order to access the SMC controller the memory controller must have
   * I/O bus enabled. Find first memory controller.
   */
  if (ambapp_find_apbslv(&ambapp_plb, VENDOR_ESA, ESA_MCTRL, &apbmctrl) != 1) {
    if (ambapp_find_apbslv(&ambapp_plb, VENDOR_GAISLER, GAISLER_FTMCTRL,
                           &apbmctrl) != 1) {
      if (ambapp_find_apbslv(&ambapp_plb, VENDOR_GAISLER, GAISLER_FTSRCTRL,
                             &apbmctrl) != 1) {
        if (ambapp_find_apbslv(&ambapp_plb, VENDOR_GAISLER, GAISLER_FTSRCTRL8,
                               &apbmctrl) != 1) {
          printk("SMC9111_leon3: didn't find any memory controller\n");
          return 0;
        }
      }
    }
  }

  /* Get  controller address */
  addr_mctrl = (unsigned long) apbmctrl.start;
  io = (struct grgpio_regs *) apbpio.start;

  printk(
        "Activating Leon3 io port for smsc_lan91cxx (pio:%x mctrl:%x)\n",
        (unsigned int)io,
        (unsigned int)addr_mctrl);

  /* Setup PIO IRQ */
  io->imask |= (1 << leon_scmv91111_configuration.pio);
  io->ipol |= (1 << leon_scmv91111_configuration.pio);
  io->iedge |= (1 << leon_scmv91111_configuration.pio);
  io->dir &= ~(1 << leon_scmv91111_configuration.pio);

  /* Setup memory controller I/O waitstates */
  *((volatile unsigned int *) addr_mctrl) |= 0x10f80000;	/* enable I/O area access */

  return _rtems_smc91111_driver_attach(config, &leon_scmv91111_configuration);
};
Beispiel #2
0
/*
 * Attach an SMC91111 driver to the system
 */
int rtems_smc91111_driver_attach_leon2(struct rtems_bsdnet_ifconfig *config)
{

  /* activate io area */
  printk("Activating Leon2 io port\n");
  /*configure pio */
  *((volatile unsigned int *)0x80000000) |= 0x10f80000;
  *((volatile unsigned int *)0x800000A8) |=
    (0xe0 | leon_scmv91111_configuration.pio)
      << (8 * (leon_scmv91111_configuration.vector - 4)); /* vector = irq-no */

  return _rtems_smc91111_driver_attach(config,&leon_scmv91111_configuration);
}
Beispiel #3
0
/*
 * Attach an SMC91111 driver to the system
 */
int
rtems_smc91111_driver_attach_leon3 (struct rtems_bsdnet_ifconfig *config,
				    int attach)
{
  unsigned long addr_mctrl = 0;
  LEON3_IOPORT_Regs_Map *io;

  amba_apb_device apbpio;
  amba_ahb_device apbmctrl;

  if ( amba_find_apbslv(&amba_conf,VENDOR_GAISLER,GAISLER_PIOPORT,&apbpio) != 1 ){
    printk("SMC9111_leon3: didn't find PIO\n");
    return 0;
  }

  /* Find LEON2 memory controller */
  if ( amba_find_ahbslv(&amba_conf,VENDOR_ESA,ESA_MCTRL,&apbmctrl) != 1 ){
    /* LEON2 memory controller not found, search for fault tolerant memory controller */
    if ( amba_find_ahbslv(&amba_conf,VENDOR_GAISLER,GAISLER_FTMCTRL,&apbmctrl) != 1 ) {
      printk("SMC9111_leon3: didn't find any memory controller\n");
      return 0;
    }
  }

  /* Get  controller address */
  addr_mctrl = (unsigned long) apbmctrl.start;
  io = (LEON3_IOPORT_Regs_Map *) apbpio.start;

  printk(
        "Activating Leon3 io port for smsc_lan91cxx (pio:%x mctrl:%x)\n",
        (unsigned int)io,
        (unsigned int)addr_mctrl);

  /* Setup PIO IRQ */
  io->irqmask |= (1 << leon_scmv91111_configuration.pio);
  io->irqpol |= (1 << leon_scmv91111_configuration.pio);
  io->irqedge |= (1 << leon_scmv91111_configuration.pio);
  io->iodir &= ~(1 << leon_scmv91111_configuration.pio);

  /* Setup memory controller I/O waitstates */
  *((volatile unsigned int *) addr_mctrl) |= 0x10f80000;	/* enable I/O area access */

    return _rtems_smc91111_driver_attach (config,
            &leon_scmv91111_configuration);
};