/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sys/gpio_87317.h>
#ifdef DEBUG
#endif
/* a non zero value causes debug info to be displayed */
#ifdef DEBUG
#else
#endif
/* Driver soft state structure */
struct gpio_softc {
int gp_state;
};
/* dev_ops and cb_ops entry point function declarations */
nodev, /* dump */
nodev, /* devmap */
NULL, /* for STREAMS drivers */
};
DEVO_REV, /* driver build version */
0, /* device reference count */
nulldev, /* probe */
nulldev, /* reset */
nulldev, /* power */
ddi_quiesce_not_needed, /* quiesce */
};
/* module configuration stuff */
static void *statep;
extern struct mod_ops mod_driverops;
"gpio driver",
};
&modldrv,
0
};
int
_init(void)
{
int e;
return (e);
}
if ((e = mod_install(&modlinkage)) != 0) {
}
return (e);
}
int
_fini(void)
{
int e;
if ((e = mod_remove(&modlinkage)) != 0) {
return (e);
}
return (DDI_SUCCESS);
}
int
{
}
/* ARGSUSED */
static int
{
switch (cmd) {
case DDI_INFO_DEVT2DEVINFO:
} else
break;
case DDI_INFO_DEVT2INSTANCE:
break;
default:
}
return (retval);
}
static int
{
int instance;
switch (cmd) {
case DDI_ATTACH:
/* Allocate and get the soft state structure for this instance. */
goto attach_failed;
/* Map in the gpio device registers. */
goto attach_failed;
0, 0, 0, 0);
0, 0, 0, 0);
0, 0, 0, 0);
0, 0, 0, 0);
0, 0, 0, 0);
0, 0, 0, 0);
0, 0, 0, 0);
0, 0, 0, 0);
0, 0, 0, 0);
/* Create device minor nodes. */
goto attach_failed;
}
return (DDI_SUCCESS);
case DDI_RESUME:
/* Nothing to do for a resume. */
return (DDI_SUCCESS);
default:
return (DDI_FAILURE);
}
if (softc) {
}
return (DDI_FAILURE);
}
static int
{
int instance;
switch (cmd) {
case DDI_DETACH:
return (ENXIO);
return (DDI_SUCCESS);
case DDI_SUSPEND:
/* Nothing to do in the suspend case. */
return (DDI_SUCCESS);
default:
return (DDI_FAILURE);
}
}
/* ARGSUSED */
static int
{
}
/* ARGSUSED */
static int
{
}
/* ARGSUSED */
static int
int *rvalp)
{
return (ENXIO);
/* Copy the command from user space. */
mode) != 0)
return (EFAULT);
/* Check the command arguments. We only support port 1 in bank 0. */
return (EINVAL);
}
/* Grap the instance's mutex to insure exclusive access. */
/* Get the contents of the GPIO register we're suppose to modify. */
switch (cmd) {
case GPIO_CMD_SET_BITS:
0, 0);
byte);
0, 0);
break;
case GPIO_CMD_CLR_BITS:
0, 0);
byte);
0, 0);
break;
case GPIO_CMD_GET:
sizeof (gpio_87317_op_t), mode) != 0) {
return (EFAULT);
}
break;
case GPIO_CMD_SET:
break;
default:
return (EINVAL);
}
return (0);
}
#ifdef DEBUG
void
{
if (gpio_debug_flag == 0) {
return;
}
prom_printf("gpio: ");
} else {
}
prom_printf("\n");
}
#endif