1 /*- 2 * Copyright (c) 2006 Michael Lorenz 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 14 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 15 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 16 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 18 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 * POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27 #include <sys/cdefs.h> 28 __KERNEL_RCSID(0, "$NetBSD: obiovar.h,v 1.7 2025/09/08 07:28:03 macallan Exp $"); 29 30 #ifndef OBIOVAR_H 31 #define OBIOVAR_H 32 33 /* 34 * access obio registers 35 * Since only some PowerBooks have more than one obio and in these cases we 36 * need to special-case it anyway we can safely assume that whoever wants to 37 * mess with obio registers means obio0 38 */ 39 40 void obio_write_4(int, uint32_t); 41 void obio_write_1(int, uint8_t); 42 uint32_t obio_read_4(int); 43 uint8_t obio_read_1(int); 44 int obio_space_map(bus_addr_t, bus_size_t, bus_space_handle_t *); 45 46 /* some common offsets */ 47 #define HEATHROW_FCR 0x38 48 49 #define GPIO_OUTSEL 0xf0 /* Output select */ 50 /* 0x00 GPIO bit0 is output 51 0x10 media-bay power 52 0x20 reserved 53 0x30 MPIC */ 54 55 #define GPIO_ALTOE 0x08 /* Alternate output enable */ 56 /* 0x00 Use DDR 57 0x08 Use output select */ 58 #define GPIO_DDR 0x04 /* Data direction */ 59 #define GPIO_DDR_OUTPUT 0x04 /* Output */ 60 #define GPIO_DDR_INPUT 0x00 /* Input */ 61 62 #define GPIO_LEVEL 0x02 /* Pin level (RO) */ 63 64 #define GPIO_DATA 0x01 /* Data */ 65 66 /* FCR(0x3c) bits */ 67 #define KEYLARGO_FCR1 0x3c 68 #define I2S0CLKEN 0x1000 69 #define I2S0EN 0x2000 70 #define I2S1CLKEN 0x080000 71 #define I2S1EN 0x100000 72 #define FCR3C_BITMASK "\020\25I2S1EN\24I2S1CLKEN\16I2S0EN\15I2S0CLKEN" 73 74 #endif /* OBIOVAR_H */ 75