at91var.h revision 236215
10Sstevel@tonic-gate/*- 20Sstevel@tonic-gate * Copyright (c) 2005 Olivier Houchard. All rights reserved. 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * Redistribution and use in source and binary forms, with or without 50Sstevel@tonic-gate * modification, are permitted provided that the following conditions 60Sstevel@tonic-gate * are met: 70Sstevel@tonic-gate * 1. Redistributions of source code must retain the above copyright 80Sstevel@tonic-gate * notice, this list of conditions and the following disclaimer. 90Sstevel@tonic-gate * 2. Redistributions in binary form must reproduce the above copyright 100Sstevel@tonic-gate * notice, this list of conditions and the following disclaimer in the 110Sstevel@tonic-gate * documentation and/or other materials provided with the distribution. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND 140Sstevel@tonic-gate * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 150Sstevel@tonic-gate * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 160Sstevel@tonic-gate * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE 170Sstevel@tonic-gate * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 180Sstevel@tonic-gate * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 190Sstevel@tonic-gate * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 200Sstevel@tonic-gate * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 210Sstevel@tonic-gate * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 220Sstevel@tonic-gate * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 230Sstevel@tonic-gate * SUCH DAMAGE. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate/* $FreeBSD: head/sys/arm/at91/at91var.h 236215 2012-05-29 03:23:18Z imp $ */ 270Sstevel@tonic-gate 280Sstevel@tonic-gate#ifndef _AT91VAR_H_ 290Sstevel@tonic-gate#define _AT91VAR_H_ 300Sstevel@tonic-gate 310Sstevel@tonic-gate#include <sys/bus.h> 320Sstevel@tonic-gate#include <sys/rman.h> 330Sstevel@tonic-gate 340Sstevel@tonic-gate#include <arm/at91/at91reg.h> 350Sstevel@tonic-gate 360Sstevel@tonic-gatestruct at91_softc { 370Sstevel@tonic-gate device_t dev; 380Sstevel@tonic-gate bus_space_tag_t sc_st; 390Sstevel@tonic-gate bus_space_handle_t sc_sh; 400Sstevel@tonic-gate bus_space_handle_t sc_aic_sh; 410Sstevel@tonic-gate struct rman sc_irq_rman; 420Sstevel@tonic-gate struct rman sc_mem_rman; 430Sstevel@tonic-gate uint32_t sc_irq_system; 440Sstevel@tonic-gate}; 450Sstevel@tonic-gate 460Sstevel@tonic-gatestruct at91_ivar { 470Sstevel@tonic-gate struct resource_list resources; 480Sstevel@tonic-gate}; 490Sstevel@tonic-gate 500Sstevel@tonic-gatestruct cpu_devs 510Sstevel@tonic-gate{ 520Sstevel@tonic-gate const char *name; 530Sstevel@tonic-gate int unit; 540Sstevel@tonic-gate bus_addr_t mem_base; 550Sstevel@tonic-gate bus_size_t mem_len; 560Sstevel@tonic-gate int irq0; 570Sstevel@tonic-gate int irq1; 580Sstevel@tonic-gate int irq2; 590Sstevel@tonic-gate const char *parent_clk; 600Sstevel@tonic-gate}; 610Sstevel@tonic-gate 620Sstevel@tonic-gateextern uint32_t at91_chip_id; 630Sstevel@tonic-gate 640Sstevel@tonic-gatestatic inline int at91_is_rm92(void); 650Sstevel@tonic-gatestatic inline int at91_is_sam9(void); 660Sstevel@tonic-gatestatic inline int at91_is_sam9xe(void); 670Sstevel@tonic-gatestatic inline int at91_cpu_is(u_int cpu); 680Sstevel@tonic-gate 690Sstevel@tonic-gatestatic inline int 700Sstevel@tonic-gateat91_is_rm92(void) 710Sstevel@tonic-gate{ 720Sstevel@tonic-gate 730Sstevel@tonic-gate return (AT91_ARCH(at91_chip_id) == AT91_ARCH_RM92); 740Sstevel@tonic-gate} 750Sstevel@tonic-gate 760Sstevel@tonic-gatestatic inline int 770Sstevel@tonic-gateat91_is_sam9(void) 780Sstevel@tonic-gate{ 790Sstevel@tonic-gate 800Sstevel@tonic-gate return (AT91_ARCH(at91_chip_id) == AT91_ARCH_SAM9); 810Sstevel@tonic-gate} 820Sstevel@tonic-gate 830Sstevel@tonic-gatestatic inline int 840Sstevel@tonic-gateat91_is_sam9xe(void) 850Sstevel@tonic-gate{ 860Sstevel@tonic-gate 870Sstevel@tonic-gate return (AT91_ARCH(at91_chip_id) == AT91_ARCH_SAM9XE); 880Sstevel@tonic-gate} 890Sstevel@tonic-gate 900Sstevel@tonic-gatestatic inline int 910Sstevel@tonic-gateat91_cpu_is(u_int cpu) 920Sstevel@tonic-gate{ 930Sstevel@tonic-gate 940Sstevel@tonic-gate return (AT91_CPU(at91_chip_id) == cpu); 950Sstevel@tonic-gate} 960Sstevel@tonic-gate 970Sstevel@tonic-gateextern uint32_t at91_irq_system; 980Sstevel@tonic-gateextern uint32_t at91_master_clock; 990Sstevel@tonic-gate 1000Sstevel@tonic-gatevoid at91_pmc_init_clock(void); 1010Sstevel@tonic-gate 1020Sstevel@tonic-gate#endif /* _AT91VAR_H_ */ 1030Sstevel@tonic-gate