summaryrefslogtreecommitdiff
path: root/src/mainboard/nokia/ip530/mainboard.c
blob: 61537c8be80b4498eddd53c9cc30dec169b81d1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
 * This file is part of the coreboot project.
 *
 * Copyright (C) 2010 Marc Bertens <mbertens@xs4all.nl>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 */

#include <device/device.h>
#include "chip.h"
#include <device/pci_def.h>
#include <device/pci.h>
#include <arch/io.h>
#include <device/pnp_def.h>
#include <console/console.h>
#define OUTB	outb
#define INB		inb

/*
*	Taken from flashrom project
*	Generic Super I/O helper functions
*/
static uint8_t sio_read(uint16_t port, uint8_t reg)
{
	OUTB( reg, port );
	return ( INB( port + 1 ) );
}

static void sio_write(uint16_t port, uint8_t reg, uint8_t data)
{
	OUTB( reg, port );
	OUTB( data, port + 1 );
	return;
}

static void nokia_ip530_board_enable( device_t dev )
{
	print_debug( "Setting up IP530-Super I/O devices\n");
	sio_write( 0x20, 0x03, 0x80 );
	printk( BIOS_DEBUG, "--Register 0x03 = %X := 0x80\n", sio_read( 0x20, 0x03 ) );
	sio_write( 0x20, 0x22, 0x30 );
	printk( BIOS_DEBUG, "--Register 0x22 = %X := 0x30\n", sio_read( 0x20, 0x22 ) );
	sio_write( 0x20, 0x24, 0x84 );
	printk( BIOS_DEBUG, "--Register 0x24 = %X := 0x84\n", sio_read( 0x20, 0x24 ) );
	return;
}

struct chip_operations mainboard_ops = {
	CHIP_NAME("Nokia IP530 Mainboard")
	.enable_dev = nokia_ip530_board_enable,
};