summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/sparc/leon2/leon_smc91111/leon_smc91111.c
blob: cf9c73f76d1ade87f73a79be8a8a1f795ba6a047 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
 *  $Id$
 */

#include <rtems.h>

#include <bsp.h>
#include <stdio.h>

#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <rtems/error.h>
#include <rtems/rtems_bsdnet.h>

#include <sys/param.h>
#include <sys/mbuf.h>

#include <sys/socket.h>
#include <sys/sockio.h>
#include <net/if.h>
#include <netinet/in.h>
#include <netinet/if_ether.h>

#include <libchip/smc91111exp.h>


#define SMC91111_BASE_ADDR (void*)0x20000300
#define SMC91111_BASE_IRQ  LEON_TRAP_TYPE(4)
#define SMC91111_BASE_PIO  4

scmv91111_configuration_t leon_scmv91111_configuration = {
  SMC91111_BASE_ADDR, /* base address */ 
  SMC91111_BASE_IRQ,  /* vector number */ 
  SMC91111_BASE_PIO,  /* PIO */ 
  100,                 /* 100b */
  1,                  /* fulldx */
  1                   /* autoneg */
};

int _rtems_smc91111_driver_attach(
  struct rtems_bsdnet_ifconfig *config,
  scmv91111_configuration_t    *scm_config
);

/*
 * Attach an SMC91111 driver to the system
 */
int rtems_smc91111_driver_attach_leon2(struct rtems_bsdnet_ifconfig *config)
{

  /* activate io area */

  /*configure pio */
  *((volatile unsigned int *)0x80000000) |= 0x10f80000;
  *((volatile unsigned int *)0x800000A8) |=
    (0xe0 | leon_scmv91111_configuration.pio)
      << (8 * ((leon_scmv91111_configuration.vector & 0x0f) - 4));
  
  return _rtems_smc91111_driver_attach(config,&leon_scmv91111_configuration);

};