lbc.h revision 209908
1123302Sobrien/*- 2123302Sobrien * Copyright (c) 2006-2008, Juniper Networks, Inc. 3123302Sobrien * All rights reserved. 4123302Sobrien * 5128725Sru * Redistribution and use in source and binary forms, with or without 6128724Sru * modification, are permitted provided that the following conditions 7123302Sobrien * are met: 8123302Sobrien * 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * 26 * $FreeBSD: head/sys/powerpc/mpc85xx/lbc.h 209908 2010-07-11 21:08:29Z raj $ 27 */ 28 29#ifndef _MACHINE_LBC_H_ 30#define _MACHINE_LBC_H_ 31 32/* Maximum number of devices on Local Bus */ 33#define LBC_DEV_MAX 8 34 35/* Local access registers */ 36#define LBC85XX_BR(n) (8 * n) 37#define LBC85XX_OR(n) (4 + (8 * n)) 38#define LBC85XX_LBCR (0xd0) 39#define LBC85XX_LCRR (0xd4) 40 41/* LBC machine select */ 42#define LBCRES_MSEL_GPCM 0 43#define LBCRES_MSEL_FCM 1 44#define LBCRES_MSEL_UPMA 8 45#define LBCRES_MSEL_UPMB 9 46#define LBCRES_MSEL_UPMC 10 47 48/* LBC data error checking modes */ 49#define LBCRES_DECC_DISABLED 0 50#define LBCRES_DECC_NORMAL 1 51#define LBCRES_DECC_RMW 2 52 53/* LBC atomic operation modes */ 54#define LBCRES_ATOM_DISABLED 0 55#define LBCRES_ATOM_RAWA 1 56#define LBCRES_ATOM_WARA 2 57 58struct lbc_bank { 59 u_long pa; /* physical addr of the bank */ 60 u_long size; /* bank size */ 61 vm_offset_t va; /* VA of the bank */ 62 63 /* 64 * XXX the following bank attributes do not have properties specified 65 * in the LBC DTS bindings yet (11.2009), so they are mainly a 66 * placeholder for future extensions. 67 */ 68 int width; /* data bus width */ 69 uint8_t msel; /* machine select */ 70 uint8_t atom; /* atomic op mode */ 71 uint8_t wp; /* write protect */ 72 uint8_t decc; /* data error checking */ 73}; 74 75struct lbc_softc { 76 device_t sc_dev; 77 struct resource *sc_res; 78 bus_space_handle_t sc_bsh; 79 bus_space_tag_t sc_bst; 80 int sc_rid; 81 82 struct rman sc_rman; 83 84 int sc_addr_cells; 85 int sc_size_cells; 86 87 struct lbc_bank sc_banks[LBC_DEV_MAX]; 88}; 89 90struct lbc_devinfo { 91 struct ofw_bus_devinfo di_ofw; 92 struct resource_list di_res; 93 int di_bank; 94}; 95 96#endif /* _MACHINE_LBC_H_ */ 97