source: rtems/c/src/lib/libbsp/sparc/leon3/leon_smc91111/leon_smc91111.c @ 55cb7c9

4.104.114.84.95
Last change on this file since 55cb7c9 was 55cb7c9, checked in by Joel Sherrill <joel.sherrill@…>, on 05/09/07 at 17:49:58

2007-05-09 Joel Sherrill <joel.sherrill@…>

  • console/debugputs.c, include/bsp.h, leon_smc91111/leon_smc91111.c, startup/bspstart.c, startup/spurious.c: Remove debug print methods that are redundant with prntk and replace their use with printk.
  • Property mode set to 100644
File size: 2.8 KB
RevLine 
[41c9282]1/*
2 *  $Id$
3 */
4
5#include <bsp.h>
6#include <libchip/smc91111exp.h>
7#include <stdio.h>
8
9
10#define SMC91111_BASE_ADDR (void*)0x20000300
11#define SMC91111_BASE_IRQ  4
12#define SMC91111_BASE_PIO  4
13
14scmv91111_configuration_t leon_scmv91111_configuration = {
15  SMC91111_BASE_ADDR,                 /* base address */
16  LEON_TRAP_TYPE(SMC91111_BASE_IRQ),  /* vector number */
17  SMC91111_BASE_PIO,                  /* PIO */
18  10,                                 /* 10b */
19  1,                                  /* fulldx */
20  1                                   /* autoneg */
21};
22
23int _rtems_smc91111_driver_attach(
24  struct rtems_bsdnet_ifconfig *config,
25  scmv91111_configuration_t    *scm_config
26);
27
28/*
29 * Attach an SMC91111 driver to the system
30 */
31int rtems_smc91111_driver_attach_leon3 (
32  struct rtems_bsdnet_ifconfig *config,
33  int                           attach
34)
35{
36  unsigned int iobar, conf,i;
37
38  {
39    unsigned long irq_pio, irq_mctrl, addr_pio = 0;
40    unsigned long addr_mctrl = 0, addr_timer = 0;
41
42    i = 0;
43    while (i < amba_conf.apbslv.devnr)
44      {
45        conf = amba_get_confword(amba_conf.apbslv, i, 0);
46        if ((amba_vendor(conf) == VENDOR_GAISLER) &&
47            (amba_device(conf) == GAISLER_PIOPORT))
48    {
49      irq_pio = amba_irq(conf);
50      iobar = amba_apb_get_membar(amba_conf.apbslv, i);     
51      addr_pio = (unsigned long) amba_iobar_start(amba_conf.apbmst, iobar);
52    }
53        else if ((amba_vendor(conf) == VENDOR_ESA) &&
54                 (amba_device(conf) == ESA_MCTRL))
55    {
56      irq_mctrl = amba_irq(conf);
57      iobar = amba_apb_get_membar(amba_conf.apbslv, i);     
58      addr_mctrl = (unsigned long) amba_iobar_start(amba_conf.apbmst, iobar);
59    }
60        else if ((amba_vendor(conf) == VENDOR_GAISLER) &&
61                 (amba_device(conf) == GAISLER_GPTIMER))
62    {
63      iobar = amba_apb_get_membar(amba_conf.apbslv, i);     
64      addr_timer = (unsigned long) amba_iobar_start(amba_conf.apbmst, iobar);
65    }
66        i++;
67      }
68
69    if (addr_timer) {
70      LEON3_Timer_Regs_Map *timer = (LEON3_Timer_Regs_Map *)addr_timer;
71      if (timer->scaler_reload >= 49)
72        leon_scmv91111_configuration.ctl_rspeed = 100;
73    }
74   
75    if (addr_pio && addr_mctrl) {
76     
77      LEON3_IOPORT_Regs_Map *io = (LEON3_IOPORT_Regs_Map *) addr_pio;
[55cb7c9]78      printk(
79        "Activating Leon3 io port for smsc_lan91cxx (pio:%x mctrl:%x)\n",
80        (unsigned int)addr_pio,
81        (unsigned int)addr_mctrl);
[41c9282]82     
83      *((volatile unsigned int *)addr_mctrl) |= 0x10f80000;  /*mctrl ctrl 1 */
84      io->irqmask |= (1 << leon_scmv91111_configuration.pio);
85      io->irqpol |= (1 << leon_scmv91111_configuration.pio);
86      io->irqedge |= (1 << leon_scmv91111_configuration.pio);
87      io->iodir &= ~(1 << leon_scmv91111_configuration.pio);
88    } else {
89      return 0;
90    }
91  }
92 
93  return _rtems_smc91111_driver_attach(config,&leon_scmv91111_configuration);
94};
95
Note: See TracBrowser for help on using the repository browser.