Victor Rodriguez | 6c18c91 | 2010-09-23 11:28:40 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Hawkboard.org based on TI's OMAP-L138 Platform |
| 3 | * |
| 4 | * Initial code: Syed Mohammed Khasim |
| 5 | * |
| 6 | * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com |
| 7 | * |
| 8 | * This file is licensed under the terms of the GNU General Public License |
| 9 | * version 2. This program is licensed "as is" without any warranty of |
| 10 | * any kind, whether express or implied. |
| 11 | */ |
| 12 | #include <linux/kernel.h> |
| 13 | #include <linux/init.h> |
| 14 | #include <linux/console.h> |
| 15 | #include <linux/gpio.h> |
| 16 | |
| 17 | #include <asm/mach-types.h> |
| 18 | #include <asm/mach/arch.h> |
| 19 | |
| 20 | #include <mach/cp_intc.h> |
| 21 | #include <mach/da8xx.h> |
Victor Rodriguez | bb59b7f | 2010-12-27 16:43:08 -0600 | [diff] [blame^] | 22 | #include <mach/mux.h> |
| 23 | |
| 24 | #define HAWKBOARD_PHY_ID "0:07" |
| 25 | |
| 26 | static short omapl138_hawk_mii_pins[] __initdata = { |
| 27 | DA850_MII_TXEN, DA850_MII_TXCLK, DA850_MII_COL, DA850_MII_TXD_3, |
| 28 | DA850_MII_TXD_2, DA850_MII_TXD_1, DA850_MII_TXD_0, DA850_MII_RXER, |
| 29 | DA850_MII_CRS, DA850_MII_RXCLK, DA850_MII_RXDV, DA850_MII_RXD_3, |
| 30 | DA850_MII_RXD_2, DA850_MII_RXD_1, DA850_MII_RXD_0, DA850_MDIO_CLK, |
| 31 | DA850_MDIO_D, |
| 32 | -1 |
| 33 | }; |
| 34 | |
| 35 | static __init void omapl138_hawk_config_emac(void) |
| 36 | { |
| 37 | void __iomem *cfgchip3 = DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG); |
| 38 | int ret; |
| 39 | u32 val; |
| 40 | struct davinci_soc_info *soc_info = &davinci_soc_info; |
| 41 | |
| 42 | val = __raw_readl(cfgchip3); |
| 43 | val &= ~BIT(8); |
| 44 | ret = davinci_cfg_reg_list(omapl138_hawk_mii_pins); |
| 45 | if (ret) { |
| 46 | pr_warning("%s: cpgmac/mii mux setup failed: %d\n", |
| 47 | __func__, ret); |
| 48 | return; |
| 49 | } |
| 50 | |
| 51 | /* configure the CFGCHIP3 register for MII */ |
| 52 | __raw_writel(val, cfgchip3); |
| 53 | pr_info("EMAC: MII PHY configured\n"); |
| 54 | |
| 55 | soc_info->emac_pdata->phy_id = HAWKBOARD_PHY_ID; |
| 56 | |
| 57 | ret = da8xx_register_emac(); |
| 58 | if (ret) |
| 59 | pr_warning("%s: emac registration failed: %d\n", |
| 60 | __func__, ret); |
| 61 | } |
| 62 | |
Victor Rodriguez | 6c18c91 | 2010-09-23 11:28:40 -0500 | [diff] [blame] | 63 | |
| 64 | static struct davinci_uart_config omapl138_hawk_uart_config __initdata = { |
| 65 | .enabled_uarts = 0x7, |
| 66 | }; |
| 67 | |
| 68 | static __init void omapl138_hawk_init(void) |
| 69 | { |
| 70 | int ret; |
| 71 | |
| 72 | davinci_serial_init(&omapl138_hawk_uart_config); |
| 73 | |
Victor Rodriguez | bb59b7f | 2010-12-27 16:43:08 -0600 | [diff] [blame^] | 74 | omapl138_hawk_config_emac(); |
| 75 | |
Victor Rodriguez | 6c18c91 | 2010-09-23 11:28:40 -0500 | [diff] [blame] | 76 | ret = da8xx_register_watchdog(); |
| 77 | if (ret) |
| 78 | pr_warning("omapl138_hawk_init: " |
| 79 | "watchdog registration failed: %d\n", |
| 80 | ret); |
| 81 | } |
| 82 | |
| 83 | #ifdef CONFIG_SERIAL_8250_CONSOLE |
| 84 | static int __init omapl138_hawk_console_init(void) |
| 85 | { |
| 86 | if (!machine_is_omapl138_hawkboard()) |
| 87 | return 0; |
| 88 | |
| 89 | return add_preferred_console("ttyS", 2, "115200"); |
| 90 | } |
| 91 | console_initcall(omapl138_hawk_console_init); |
| 92 | #endif |
| 93 | |
| 94 | static void __init omapl138_hawk_map_io(void) |
| 95 | { |
| 96 | da850_init(); |
| 97 | } |
| 98 | |
| 99 | MACHINE_START(OMAPL138_HAWKBOARD, "AM18x/OMAP-L138 Hawkboard") |
Victor Rodriguez | 6c18c91 | 2010-09-23 11:28:40 -0500 | [diff] [blame] | 100 | .boot_params = (DA8XX_DDR_BASE + 0x100), |
| 101 | .map_io = omapl138_hawk_map_io, |
| 102 | .init_irq = cp_intc_init, |
| 103 | .timer = &davinci_timer, |
| 104 | .init_machine = omapl138_hawk_init, |
| 105 | MACHINE_END |