Gabe Black | d40be11 | 2013-10-09 23:45:07 -0700 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2007-2009 coresystems GmbH |
| 5 | * Copyright (C) 2011 The ChromiumOS Authors. All rights reserved. |
| 6 | * Copyright 2013 Google Inc. |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by |
| 10 | * the Free Software Foundation; version 2 of the License. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program; if not, write to the Free Software |
| 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | */ |
| 21 | |
| 22 | #include <console/console.h> |
| 23 | #include <device/device.h> |
| 24 | #include <soc/nvidia/tegra/dc.h> |
Tom Warren | 64982c50 | 2014-01-23 13:37:50 -0700 | [diff] [blame] | 25 | #include <soc/nvidia/tegra124/sdram.h> |
| 26 | #include <soc/display.h> |
Gabe Black | d40be11 | 2013-10-09 23:45:07 -0700 | [diff] [blame] | 27 | |
| 28 | /* this sucks, but for now, fb size/location are hardcoded. |
| 29 | * Will break if we get 2. Sigh. |
| 30 | * We assume it's all multiples of MiB for MMUs sake. |
| 31 | */ |
| 32 | static void soc_enable(device_t dev) |
| 33 | { |
Tom Warren | 64982c50 | 2014-01-23 13:37:50 -0700 | [diff] [blame] | 34 | u32 lcdbase = fb_base_mb(); |
Gabe Black | d40be11 | 2013-10-09 23:45:07 -0700 | [diff] [blame] | 35 | unsigned long fb_size = FB_SIZE_MB; |
Tom Warren | 64982c50 | 2014-01-23 13:37:50 -0700 | [diff] [blame] | 36 | |
Gabe Black | d40be11 | 2013-10-09 23:45:07 -0700 | [diff] [blame] | 37 | ram_resource(dev, 0, CONFIG_SYS_SDRAM_BASE/KiB, |
Tom Warren | 64982c50 | 2014-01-23 13:37:50 -0700 | [diff] [blame] | 38 | (sdram_size_mb() - fb_size)*KiB); |
Gabe Black | d40be11 | 2013-10-09 23:45:07 -0700 | [diff] [blame] | 39 | mmio_resource(dev, 1, lcdbase*KiB, fb_size*KiB); |
| 40 | } |
| 41 | |
| 42 | static void soc_init(device_t dev) |
| 43 | { |
| 44 | display_startup(dev); |
| 45 | printk(BIOS_INFO, "CPU: Tegra124\n"); |
| 46 | } |
| 47 | |
Gabe Black | d40be11 | 2013-10-09 23:45:07 -0700 | [diff] [blame] | 48 | static struct device_operations soc_ops = { |
Edward O'Callaghan | 0625a8b | 2014-10-31 08:03:16 +1100 | [diff] [blame^] | 49 | .read_resources = DEVICE_NOOP, |
| 50 | .set_resources = DEVICE_NOOP, |
Gabe Black | d40be11 | 2013-10-09 23:45:07 -0700 | [diff] [blame] | 51 | .enable_resources = soc_enable, |
| 52 | .init = soc_init, |
| 53 | .scan_bus = 0, |
| 54 | }; |
| 55 | |
| 56 | static void enable_tegra124_dev(device_t dev) |
| 57 | { |
| 58 | dev->ops = &soc_ops; |
| 59 | } |
| 60 | |
| 61 | struct chip_operations soc_nvidia_tegra124_ops = { |
| 62 | CHIP_NAME("SOC Nvidia Tegra124") |
| 63 | .enable_dev = enable_tegra124_dev, |
| 64 | }; |