pmugpio.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/ddi_impldefs.h>
/*
* Time periods, in nanoseconds
*/
#define PMUGPIO_TWO_SEC 2000000000LL
static dev_info_t *pmugpio_dip;
typedef struct pmugpio_state {
static void *pmugpio_statep;
void **result);
struct cb_ops pmugpio_cb_ops = {
nulldev, /* open */
nulldev, /* close */
nulldev, /* strategy */
nulldev, /* print */
nulldev, /* dump */
nulldev, /* read */
nulldev, /* write */
nulldev, /* ioctl */
nulldev, /* devmap */
nulldev, /* mmap */
nulldev, /* segmap */
nochpoll, /* poll */
ddi_prop_op, /* cb_prop_op */
NULL, /* streamtab */
};
static struct dev_ops pmugpio_ops = {
DEVO_REV, /* Devo_rev */
0, /* Refcnt */
pmugpio_info, /* Info */
nulldev, /* Identify */
nulldev, /* Probe */
pmugpio_attach, /* Attach */
pmugpio_detach, /* Detach */
nodev, /* Reset */
&pmugpio_cb_ops, /* Driver operations */
0, /* Bus operations */
NULL /* Power */
};
&mod_driverops, /* This one is a driver */
"Pmugpio Driver %I%", /* Name of the module. */
&pmugpio_ops, /* Driver ops */
};
static struct modlinkage modlinkage = {
};
int
_init(void)
{
int error;
/* Initialize the soft state structures */
sizeof (pmugpio_state_t), 1)) != 0) {
return (error);
}
/* Install the loadable module */
}
return (error);
}
int
{
}
int
_fini(void)
{
int error;
if (error == 0) {
/* Release per module resources */
}
return (error);
}
static int
{
int instance;
switch (cmd) {
case DDI_ATTACH:
break;
case DDI_RESUME:
return (DDI_SUCCESS);
default:
return (DDI_FAILURE);
}
/* Get the instance and create soft state */
return (DDI_FAILURE);
}
if (pmugpio_ptr == NULL) {
return (DDI_FAILURE);
}
return (DDI_FAILURE);
}
/* Display information in the banner */
/* Save the dip */
pmugpio_dip = dip;
return (DDI_SUCCESS);
}
/* ARGSUSED */
static int
{
/* Pointer to soft state */
switch (cmd) {
case DDI_SUSPEND:
return (DDI_SUCCESS);
default:
return (DDI_FAILURE);
}
}
/* ARGSUSED */
static int
{
switch (infocmd) {
case DDI_INFO_DEVT2DEVINFO:
*result = (void *)pmugpio_dip;
error = DDI_SUCCESS;
break;
case DDI_INFO_DEVT2INSTANCE:
error = DDI_SUCCESS;
break;
default:
error = DDI_FAILURE;
}
return (error);
}
void
pmugpio_watchdog_pat(void)
{
int instance;
return;
}
if (pmugpio_ptr == NULL) {
return;
}
/*
* The RMC can read interrupts either high to low OR low to high. As
* a result all that needs to happen is that when we hit the time to
* send an signal we simply need to change the state.
*/
/*
* fetch current reg value and invert it
*/
}
}
void
pmugpio_reset(void)
{
int instance;
return;
}
if (pmugpio_ptr == NULL) {
return;
}
/*
* turn all bits on then off again - pmubus nexus will ensure
* that only unmasked bit is affected
*/
pmugpio_ptr->pmugpio_reset_reg, ~0);
pmugpio_ptr->pmugpio_reset_reg, 0);
}
static int
{
/* The host controller will be little endian */
return (DDI_FAILURE);
}
if (ddi_regs_map_setup(dip, 0,
return (DDI_FAILURE);
}
return (DDI_SUCCESS);
}