summaryrefslogtreecommitdiff
path: root/src/drivers/aspeed/ast2050
diff options
context:
space:
mode:
authorTimothy Pearson <tpearson@raptorengineeringinc.com>2015-09-05 17:38:09 -0500
committerPeter Stuge <peter@stuge.se>2015-10-24 06:28:08 +0200
commit04cf449e7727627969dadaf1aec829c429460ced (patch)
treee70dffd40200507ac96969022f517c6015ed4cde /src/drivers/aspeed/ast2050
parentc3fcdccb816f9c5df5a3c158d167a20c1ae088ee (diff)
drivers/aspeed: Add native text mode VGA support for the AST2050
Change-Id: I37763a59d2546cd0c0e57b31fdb7aa77c2c50bee Signed-off-by: Timothy Pearson <tpearson@raptorengineeringinc.com> Reviewed-on: http://review.coreboot.org/11937 Reviewed-by: Peter Stuge <peter@stuge.se> Tested-by: build bot (Jenkins)
Diffstat (limited to 'src/drivers/aspeed/ast2050')
-rw-r--r--src/drivers/aspeed/ast2050/Kconfig14
-rw-r--r--src/drivers/aspeed/ast2050/Makefile.inc1
-rw-r--r--src/drivers/aspeed/ast2050/ast2050.c83
3 files changed, 98 insertions, 0 deletions
diff --git a/src/drivers/aspeed/ast2050/Kconfig b/src/drivers/aspeed/ast2050/Kconfig
new file mode 100644
index 0000000000..f110d58bf5
--- /dev/null
+++ b/src/drivers/aspeed/ast2050/Kconfig
@@ -0,0 +1,14 @@
+config DRIVERS_ASPEED_AST2050
+ bool
+
+if DRIVERS_ASPEED_AST2050
+
+config DEVICE_SPECIFIC_OPTIONS # dummy
+ def_bool y
+ select DRIVERS_ASPEED_AST_COMMON
+
+config NATIVE_VGA_INIT_USE_EDID
+ bool
+ default n
+
+endif # DRIVERS_ASPEED_AST2050
diff --git a/src/drivers/aspeed/ast2050/Makefile.inc b/src/drivers/aspeed/ast2050/Makefile.inc
new file mode 100644
index 0000000000..9e5b5c54ee
--- /dev/null
+++ b/src/drivers/aspeed/ast2050/Makefile.inc
@@ -0,0 +1 @@
+ramstage-$(CONFIG_DRIVERS_ASPEED_AST2050) += ast2050.c
diff --git a/src/drivers/aspeed/ast2050/ast2050.c b/src/drivers/aspeed/ast2050/ast2050.c
new file mode 100644
index 0000000000..809e9de768
--- /dev/null
+++ b/src/drivers/aspeed/ast2050/ast2050.c
@@ -0,0 +1,83 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2015 Timothy Pearson <tpearson@raptorengineeringinc.com>, Raptor Engineering
+ *
+ * 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; version 2 of the License.
+ *
+ * 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 <delay.h>
+#include <stdlib.h>
+#include <string.h>
+#include <arch/io.h>
+#include <edid.h>
+
+#include <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include <device/pci_ops.h>
+
+#include <pc80/vga.h>
+
+#include "../common/aspeed_coreboot.h"
+#include "../common/ast_drv.h"
+
+static void aspeed_ast2050_set_resources(device_t dev)
+{
+ /* Reserve VGA regions */
+ mmio_resource(dev, 3, 0xa0000 >> 10, 0x1ffff >> 10);
+
+ /* Run standard resource set routine */
+ pci_dev_set_resources(dev);
+}
+
+static void aspeed_ast2050_init(struct device *dev)
+{
+ u8 ret;
+ struct drm_device drm_dev;
+
+ drm_dev.pdev = dev;
+
+ printk(BIOS_INFO, "ASpeed AST2050: initializing video device\n");
+ ret = ast_driver_load(&drm_dev, 0);
+
+ /* Unlock extended configuration registers */
+ outb(0x80, 0x3d4); outb(0xa8, 0x3d5);
+
+ /* Set CRT Request Threshold */
+ outb(0xa6, 0x3d4); outb(0x2f, 0x3d5);
+ outb(0xa7, 0x3d4); outb(0x3f, 0x3d5);
+
+ /* Initialize standard VGA text mode */
+ vga_io_init();
+ vga_textmode_init();
+ printk(BIOS_INFO, "ASpeed VGA text mode initialized\n");
+
+ /* if we don't have console, at least print something... */
+ vga_line_write(0, "ASpeed VGA text mode initialized");
+}
+
+static struct device_operations aspeed_ast2050_ops = {
+ .read_resources = pci_dev_read_resources,
+ .set_resources = aspeed_ast2050_set_resources,
+ .enable_resources = pci_dev_enable_resources,
+ .init = aspeed_ast2050_init,
+ .scan_bus = 0,
+};
+
+static const struct pci_driver aspeed_ast2050_driver __pci_driver = {
+ .ops = &aspeed_ast2050_ops,
+ .vendor = PCI_VENDOR_ID_ASPEED,
+ .device = PCI_DEVICE_ID_ASPEED_AST2050_VGA,
+};