Home | History | Annotate | Line # | Download | only in include
      1 /*	$NetBSD: sam460ex.h,v 1.4 2026/06/22 12:34:19 rkujawa Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 2012, 2014, 2024, 2026 The NetBSD Foundation, Inc.
      5  * All rights reserved.
      6  *
      7  * This code is derived from software contributed to The NetBSD Foundation
      8  * by Radoslaw Kujawa.
      9  *
     10  * Redistribution and use in source and binary forms, with or without
     11  * modification, are permitted provided that the following conditions
     12  * are met:
     13  * 1. Redistributions of source code must retain the above copyright
     14  *    notice, this list of conditions and the following disclaimer.
     15  * 2. Redistributions in binary form must reproduce the above copyright
     16  *    notice, this list of conditions and the following disclaimer in the
     17  *    documentation and/or other materials provided with the distribution.
     18  *
     19  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     20  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     21  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     22  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     23  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     24  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     28  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     29  */
     30 
     31 /*
     32  * ACube Sam460ex board definitions.
     33  */
     34 
     35 #ifndef	_EVBPPC_SAM460EX_H_
     36 #define	_EVBPPC_SAM460EX_H_
     37 
     38 #include <powerpc/ibm4xx/amcc460ex.h>
     39 
     40 /* Boot loader handoff (set in machdep.c initppc()) */
     41 #ifndef _LOCORE
     42 extern paddr_t sam460ex_fdt_pa;
     43 extern uint32_t sam460ex_epapr_magic;
     44 
     45 /* Values extracted from the U-Boot/QEMU device tree (0 = absent) */
     46 #define	SAM460EX_NEMAC	2
     47 struct sam460ex_fdt_info {
     48 	uint32_t fi_memsize;
     49 	uint32_t fi_cpu_freq;
     50 	uint32_t fi_timebase_freq;
     51 	uint32_t fi_opb_freq;
     52 	uint32_t fi_uart_freq;
     53 	const char *fi_bootargs;
     54 	/* EMAC MAC addresses (all-zero = absent/not fixed up) */
     55 	uint8_t fi_enaddr[SAM460EX_NEMAC][6];
     56 	bool fi_enaddr_valid[SAM460EX_NEMAC];
     57 };
     58 extern struct sam460ex_fdt_info sam460ex_fdt_info;
     59 
     60 bool sam460ex_fdt_parse(paddr_t);
     61 #endif
     62 
     63 /*
     64  * UART input clock for the console and com devices
     65  */
     66 uint32_t sam460ex_com_freq(void);
     67 
     68 /*
     69  * Console target, selected by the "console=" bootarg
     70  */
     71 enum sam460ex_console {
     72 	SAM460EX_CONS_COM,
     73 	SAM460EX_CONS_SM502,
     74 	SAM460EX_CONS_PCI,
     75 };
     76 extern enum sam460ex_console sam460ex_console;
     77 extern int sam460ex_console_pci_bdf[3];
     78 
     79 /* ePAPR magic passed in r6 by U-Boot and QEMU */
     80 #define	SAM460EX_EPAPR_MAGIC	0x45504150
     81 
     82 /*
     83  * Kernel VA for I/O
     84  *	0xe0000000  PCIE1 local-config (XCFG: inbound BAR/PIM regs, 16MB)
     85  *      0xef000000  OPB (16MB)
     86  *	0xf0000000  PCI memory window  (AMCC460EX_PCIX0_MEM_SIZE)
     87  *	0xf5000000  PCI I/O window     (16MB entry, 64KB used)
     88  *	0xf6000000  PCIX config + internal registers (16MB entry)
     89  *	0xf7000000  PCIE0 config window (ECAM, 16MB)
     90  *	0xf8000000  PCIE1 config window (ECAM, 16MB)
     91  *	0xf9000000  PCIE0 memory window (16MB)
     92  *	0xfa000000  PCIE1 memory window (16MB)
     93  *	0xfb000000  AHB peripherals: USB OTG/OHCI/EHCI (16MB)
     94  *	0xfc000000  PCI prefetchable window (POM1, 64MB pinned of 256MB)
     95  */
     96 #define	SAM460EX_PCIE1XCFG_VA	0xe0000000
     97 #define	SAM460EX_PCIMEM_VA	0xf0000000
     98 #define	SAM460EX_PCIIO_VA	0xf5000000
     99 #define	SAM460EX_PCICFG_VA	0xf6000000
    100 #define	SAM460EX_PCIE0CFG_VA	0xf7000000
    101 #define	SAM460EX_PCIE1CFG_VA	0xf8000000
    102 #define	SAM460EX_PCIE0MEM_VA	0xf9000000
    103 #define	SAM460EX_PCIE1MEM_VA	0xfa000000
    104 #define	SAM460EX_AHB_VA		0xfb000000
    105 #define	SAM460EX_PCIPREFMEM_VA	0xfc000000
    106 
    107 #endif	/* _EVBPPC_SAM460EX_H_ */
    108