2018-04-20 00:50:06 +03:00
|
|
|
/* $NetBSD: voyagervar.h,v 1.5 2018/04/19 21:50:09 christos Exp $ */
|
2011-08-31 20:47:31 +04:00
|
|
|
|
|
|
|
/*
|
2011-09-06 10:26:13 +04:00
|
|
|
* Copyright (c) 2011 Michael Lorenz
|
2011-08-31 20:47:31 +04:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/cdefs.h>
|
2018-04-20 00:50:06 +03:00
|
|
|
__KERNEL_RCSID(0, "$NetBSD: voyagervar.h,v 1.5 2018/04/19 21:50:09 christos Exp $");
|
2011-08-31 20:47:31 +04:00
|
|
|
|
|
|
|
#ifndef VOYAGERVAR_H
|
|
|
|
#define VOYAGERVAR_H
|
|
|
|
|
2011-10-18 21:57:40 +04:00
|
|
|
#include <dev/pci/pcivar.h>
|
|
|
|
#include <dev/pci/pcireg.h>
|
|
|
|
|
2011-08-31 20:47:31 +04:00
|
|
|
struct voyager_attach_args {
|
|
|
|
pci_chipset_tag_t vaa_pc;
|
|
|
|
pcitag_t vaa_pcitag;
|
|
|
|
bus_space_tag_t vaa_tag;
|
|
|
|
bus_space_handle_t vaa_regh;
|
|
|
|
bus_space_handle_t vaa_memh;
|
|
|
|
bus_addr_t vaa_reg_pa;
|
|
|
|
bus_addr_t vaa_mem_pa;
|
|
|
|
char vaa_name[32];
|
|
|
|
};
|
|
|
|
|
2011-12-07 13:08:00 +04:00
|
|
|
void voyager_twiddle_bits(void *, int, uint32_t, uint32_t);
|
|
|
|
|
2011-10-18 21:57:40 +04:00
|
|
|
/* set gpio bits - (register & param1) | param2 */
|
2011-12-07 13:08:00 +04:00
|
|
|
#define voyager_write_gpio(cookie, m_and, m_or) \
|
|
|
|
voyager_twiddle_bits(cookie, SM502_GPIO_DATA0, m_and, m_or)
|
2011-10-18 21:57:40 +04:00
|
|
|
/* control gpio pin usage - 0 is gpio, 1 is other stuff ( like PWM ) */
|
2011-12-07 13:08:00 +04:00
|
|
|
#define voyager_control_gpio(cookie, m_and, m_or) \
|
|
|
|
voyager_twiddle_bits(cookie, SM502_GPIO0_CONTROL, m_and, m_or)
|
|
|
|
/* gpio direction - 1 is output */
|
|
|
|
#define voyager_gpio_dir(cookie, m_and, m_or) \
|
|
|
|
voyager_twiddle_bits(cookie, SM502_GPIO_DIR0, m_and, m_or)
|
|
|
|
#define voyager_control_power_0(cookie, m_and, m_or) \
|
|
|
|
voyager_twiddle_bits(cookie, SM502_POWER_MODE0_GATE, m_and, m_or)
|
2011-10-18 21:57:40 +04:00
|
|
|
|
|
|
|
void *voyager_establish_intr(device_t, int, int (*)(void *), void *);
|
|
|
|
void voyager_disestablish_intr(device_t, void *);
|
|
|
|
|
|
|
|
/* frequency in Hz, duty cycle in 1000ths */
|
|
|
|
uint32_t voyager_set_pwm(int, int);
|
2011-09-06 10:26:13 +04:00
|
|
|
|
2018-04-20 00:50:06 +03:00
|
|
|
#endif
|