blob: 57406335bf3766d5016e59d6fd0c6183a31b23fa [file] [log] [blame]
Stefan Roeseb79316f2005-08-15 12:31:23 +02001#ifndef __SBCOMMON_H__
2#define __SBCOMMON_H__
3/*
4 * Copyright (C) 2005 Sandburst Corporation
5 *
Wolfgang Denk3765b3e2013-10-07 13:07:26 +02006 * SPDX-License-Identifier: GPL-2.0+
Stefan Roeseb79316f2005-08-15 12:31:23 +02007 */
8#include <config.h>
9#include <common.h>
10#include <command.h>
11#include <asm/processor.h>
12#include <asm/io.h>
13#include <spd_sdram.h>
14#include <i2c.h>
Stefan Roeseb79316f2005-08-15 12:31:23 +020015
Stefan Roeseb79316f2005-08-15 12:31:23 +020016/*
17 * GPIO Settings
18 */
19/* Chassis settings */
Wolfgang Denk3d078ce2005-08-15 16:03:56 +020020#define SBCOMMON_GPIO_PRI_N 0x00001000 /* 0 = Chassis Master, 1 = Slave */
21#define SBCOMMON_GPIO_SEC_PRES 0x00000800 /* 1 = Other board present */
Stefan Roeseb79316f2005-08-15 12:31:23 +020022
23/* Debug LEDs */
Wolfgang Denk3d078ce2005-08-15 16:03:56 +020024#define SBCOMMON_GPIO_DBGLED_0 0x00000400
25#define SBCOMMON_GPIO_DBGLED_1 0x00000200
26#define SBCOMMON_GPIO_DBGLED_2 0x00100000
27#define SBCOMMON_GPIO_DBGLED_3 0x00000100
Stefan Roeseb79316f2005-08-15 12:31:23 +020028
Wolfgang Denk3d078ce2005-08-15 16:03:56 +020029#define SBCOMMON_GPIO_DBGLEDS (SBCOMMON_GPIO_DBGLED_0 | \
30 SBCOMMON_GPIO_DBGLED_1 | \
31 SBCOMMON_GPIO_DBGLED_2 | \
32 SBCOMMON_GPIO_DBGLED_3)
Stefan Roeseb79316f2005-08-15 12:31:23 +020033
Wolfgang Denk3d078ce2005-08-15 16:03:56 +020034#define SBCOMMON_GPIO_SYS_FAULT 0x00000080
35#define SBCOMMON_GPIO_SYS_OTEMP 0x00000040
36#define SBCOMMON_GPIO_SYS_STATUS 0x00000020
Stefan Roeseb79316f2005-08-15 12:31:23 +020037
Wolfgang Denk3d078ce2005-08-15 16:03:56 +020038#define SBCOMMON_GPIO_SYS_LEDS (SBCOMMON_GPIO_SYS_STATUS)
Stefan Roeseb79316f2005-08-15 12:31:23 +020039
Wolfgang Denk3d078ce2005-08-15 16:03:56 +020040#define SBCOMMON_GPIO_LEDS (SBCOMMON_GPIO_DBGLED_0 | \
41 SBCOMMON_GPIO_DBGLED_1 | \
42 SBCOMMON_GPIO_DBGLED_2 | \
43 SBCOMMON_GPIO_DBGLED_3 | \
44 SBCOMMON_GPIO_SYS_STATUS)
Stefan Roeseb79316f2005-08-15 12:31:23 +020045
46typedef struct ppc440_gpio_regs {
47 volatile unsigned long out;
48 volatile unsigned long tri_state;
49 volatile unsigned long dummy[4];
50 volatile unsigned long open_drain;
51 volatile unsigned long in;
52} __attribute__((packed)) ppc440_gpio_regs_t;
53
Stefan Roeseb79316f2005-08-15 12:31:23 +020054int sbcommon_get_master(void);
55int sbcommon_secondary_present(void);
56unsigned short sbcommon_get_serial_number(void);
57void sbcommon_fans(void);
Mike Frysingerd8d21e62009-02-16 18:03:14 -050058void board_get_enetaddr(int macaddr_idx, uchar *enet);
Stefan Roeseb79316f2005-08-15 12:31:23 +020059
Stefan Roeseb79316f2005-08-15 12:31:23 +020060#endif /* __SBCOMMON_H__ */