PERFORCE change 144242 for review
Andrew Turner
andrew at FreeBSD.org
Sat Jun 28 21:52:06 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=144242
Change 144242 by andrew at andrew_bender on 2008/06/28 21:51:56
Add memory and ioport resource allocation to s3c2410_alloc_resource and set the uart ioport
Implement bus_release_resource
Affected files ...
.. //depot/projects/arm/src/sys/arm/s3c2xx0/s3c2410.c#14 edit
.. //depot/projects/arm/src/sys/arm/s3c2xx0/s3c2410reg.h#3 edit
.. //depot/projects/arm/src/sys/arm/s3c2xx0/s3c2xx0var.h#6 edit
Differences ...
==== //depot/projects/arm/src/sys/arm/s3c2xx0/s3c2410.c#14 (text+ko) ====
@@ -66,6 +66,8 @@
u_long, u_long, u_long, u_int);
static int s3c2410_activate_resource(device_t, device_t, int, int,
struct resource *);
+static int s3c2410_release_resource(device_t, device_t, int, int,
+ struct resource *);
static struct resource_list *s3c2410_get_resource_list(device_t, device_t);
static device_method_t s3c2410_methods[] = {
@@ -75,6 +77,7 @@
DEVMETHOD(bus_setup_intr, s3c2410_setup_intr),
DEVMETHOD(bus_alloc_resource, s3c2410_alloc_resource),
DEVMETHOD(bus_activate_resource, s3c2410_activate_resource),
+ DEVMETHOD(bus_release_resource, s3c2410_release_resource),
DEVMETHOD(bus_get_resource_list,s3c2410_get_resource_list),
DEVMETHOD(bus_set_resource, bus_generic_rl_set_resource),
DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource),
@@ -193,6 +196,15 @@
&s3c2xx0_softc->s3c2xx0_irq_rman, start, end,
count, flags, child);
break;
+
+ case SYS_RES_IOPORT:
+ case SYS_RES_MEMORY:
+ res = rman_reserve_resource(
+ &s3c2xx0_softc->s3c2xx0_mem_rman,
+ start, end, count, flags, child);
+ rman_set_bustag(res, &s3c2xx0_bs_tag);
+ rman_set_bushandle(res, start);
+ break;
}
if (res != NULL) {
@@ -211,6 +223,27 @@
return (0);
}
+static int
+s3c2410_release_resource(device_t bus, device_t child, int type, int rid,
+ struct resource *r)
+{
+ struct s3c2xx0_ivar *ivar = device_get_ivars(child);
+ struct resource_list *rl = &ivar->resources;
+ struct resource_list_entry *rle;
+
+ if (rl == NULL)
+ return (EINVAL);
+
+ rle = resource_list_find(rl, type, rid);
+ if (rle == NULL)
+ return (EINVAL);
+
+ rman_release_resource(r);
+ rle->res = NULL;
+
+ return 0;
+}
+
static struct resource_list *
s3c2410_get_resource_list(device_t dev, device_t child)
{
@@ -286,16 +319,26 @@
*/
s3c2xx0_softc->s3c2xx0_irq_rman.rm_type = RMAN_ARRAY;
s3c2xx0_softc->s3c2xx0_irq_rman.rm_descr = "S3C2410 IRQs";
+ s3c2xx0_softc->s3c2xx0_mem_rman.rm_type = RMAN_ARRAY;
+ s3c2xx0_softc->s3c2xx0_mem_rman.rm_descr = "S3C2410 Memory";
if (rman_init(&s3c2xx0_softc->s3c2xx0_irq_rman) != 0 ||
rman_manage_region(&s3c2xx0_softc->s3c2xx0_irq_rman, 0,
S3C2410_SUBIRQ_MAX - 1) != 0)
panic("s3c2410_attach: failed to set up IRQ rman");
+ /* Manage the registor memoty space */
+ if (rman_init(&s3c2xx0_softc->s3c2xx0_mem_rman) != 0 ||
+ rman_manage_region(&s3c2xx0_softc->s3c2xx0_mem_rman, S3C2410_REG_BASE,
+ S3C2410_REG_BASE + S3C2410_REG_SIZE) != 0)
+ panic("s3c2410_attach: failed to set up register rman");
+
s3c2410_add_child(dev, 0, "nand", 0);
s3c2410_add_child(dev, 0, "timer", 0);
- /* Add the uart and set it's irq */
+ /* Add the uart and set it's irq and registers */
child = s3c2410_add_child(dev, 0, "uart", 0);
bus_set_resource(child, SYS_RES_IRQ, 0, S3C2410_INT_UART0, 1);
+ bus_set_resource(child, SYS_RES_IOPORT, 0, S3C2410_UART0_BASE,
+ S3C2410_UART_BASE(1) - S3C2410_UART0_BASE);
bus_generic_probe(dev);
bus_generic_attach(dev);
==== //depot/projects/arm/src/sys/arm/s3c2xx0/s3c2410reg.h#3 (text+ko) ====
@@ -80,6 +80,9 @@
#define S3C2410_SDI_BASE 0x5a000000 /* SD Interface */
#define S3C2410_SDI_SIZE 0x44
+#define S3C2410_REG_BASE 0x48000000
+#define S3C2410_REG_SIZE 0x13000000
+
/* interrupt control (additional defs for 2410) */
#define ICU_LEN (32+11)
==== //depot/projects/arm/src/sys/arm/s3c2xx0/s3c2xx0var.h#6 (text+ko) ====
@@ -57,6 +57,7 @@
int sc_pclk; /* peripheral clock */
struct rman s3c2xx0_irq_rman;
+ struct rman s3c2xx0_mem_rman;
};
struct s3c2xx0_ivar {
More information about the p4-projects
mailing list