Sandeep Paulraj | 37dd009 | 2009-06-09 16:28:15 -0400 | [diff] [blame] | 1 | /* |
| 2 | * TI DaVinci DM365 EVM board support |
| 3 | * |
| 4 | * Copyright (C) 2009 Texas Instruments Incorporated |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License as |
| 8 | * published by the Free Software Foundation version 2. |
| 9 | * |
| 10 | * This program is distributed "as is" WITHOUT ANY WARRANTY of any |
| 11 | * kind, whether express or implied; without even the implied warranty |
| 12 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | */ |
| 15 | #include <linux/kernel.h> |
| 16 | #include <linux/module.h> |
| 17 | #include <linux/init.h> |
| 18 | #include <linux/dma-mapping.h> |
| 19 | #include <linux/i2c.h> |
| 20 | #include <linux/io.h> |
| 21 | #include <linux/clk.h> |
Sandeep Paulraj | 8ed0a9d | 2009-06-20 12:23:39 -0400 | [diff] [blame] | 22 | #include <linux/i2c/at24.h> |
Sandeep Paulraj | 37dd009 | 2009-06-09 16:28:15 -0400 | [diff] [blame] | 23 | #include <asm/setup.h> |
| 24 | #include <asm/mach-types.h> |
| 25 | #include <asm/mach/arch.h> |
| 26 | #include <asm/mach/map.h> |
Sandeep Paulraj | 8ed0a9d | 2009-06-20 12:23:39 -0400 | [diff] [blame] | 27 | #include <mach/mux.h> |
Sandeep Paulraj | 37dd009 | 2009-06-09 16:28:15 -0400 | [diff] [blame] | 28 | #include <mach/hardware.h> |
| 29 | #include <mach/dm365.h> |
| 30 | #include <mach/psc.h> |
| 31 | #include <mach/common.h> |
| 32 | #include <mach/i2c.h> |
| 33 | #include <linux/i2c.h> |
| 34 | #include <mach/serial.h> |
| 35 | #include <mach/common.h> |
Sandeep Paulraj | a45c8ba | 2009-06-20 14:00:52 -0400 | [diff] [blame^] | 36 | #include <mach/mmc.h> |
Sandeep Paulraj | 37dd009 | 2009-06-09 16:28:15 -0400 | [diff] [blame] | 37 | |
Sandeep Paulraj | 8ed0a9d | 2009-06-20 12:23:39 -0400 | [diff] [blame] | 38 | #define DM365_EVM_PHY_MASK (0x2) |
| 39 | #define DM365_EVM_MDIO_FREQUENCY (2200000) /* PHY bus frequency */ |
| 40 | |
| 41 | static struct at24_platform_data eeprom_info = { |
| 42 | .byte_len = (256*1024) / 8, |
| 43 | .page_size = 64, |
| 44 | .flags = AT24_FLAG_ADDR16, |
| 45 | .setup = davinci_get_mac_addr, |
| 46 | .context = (void *)0x7f00, |
| 47 | }; |
| 48 | |
| 49 | static struct i2c_board_info i2c_info[] = { |
| 50 | { |
| 51 | I2C_BOARD_INFO("24c256", 0x50), |
| 52 | .platform_data = &eeprom_info, |
| 53 | }, |
| 54 | }; |
| 55 | |
Sandeep Paulraj | 37dd009 | 2009-06-09 16:28:15 -0400 | [diff] [blame] | 56 | static struct davinci_i2c_platform_data i2c_pdata = { |
| 57 | .bus_freq = 400 /* kHz */, |
| 58 | .bus_delay = 0 /* usec */, |
| 59 | }; |
| 60 | |
Sandeep Paulraj | a45c8ba | 2009-06-20 14:00:52 -0400 | [diff] [blame^] | 61 | static struct davinci_mmc_config dm365evm_mmc_config = { |
| 62 | .wires = 4, |
| 63 | .max_freq = 50000000, |
| 64 | .caps = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED, |
| 65 | .version = MMC_CTLR_VERSION_2, |
| 66 | }; |
| 67 | |
Sandeep Paulraj | 8ed0a9d | 2009-06-20 12:23:39 -0400 | [diff] [blame] | 68 | static void dm365evm_emac_configure(void) |
| 69 | { |
| 70 | /* |
| 71 | * EMAC pins are multiplexed with GPIO and UART |
| 72 | * Further details are available at the DM365 ARM |
| 73 | * Subsystem Users Guide(sprufg5.pdf) pages 125 - 127 |
| 74 | */ |
| 75 | davinci_cfg_reg(DM365_EMAC_TX_EN); |
| 76 | davinci_cfg_reg(DM365_EMAC_TX_CLK); |
| 77 | davinci_cfg_reg(DM365_EMAC_COL); |
| 78 | davinci_cfg_reg(DM365_EMAC_TXD3); |
| 79 | davinci_cfg_reg(DM365_EMAC_TXD2); |
| 80 | davinci_cfg_reg(DM365_EMAC_TXD1); |
| 81 | davinci_cfg_reg(DM365_EMAC_TXD0); |
| 82 | davinci_cfg_reg(DM365_EMAC_RXD3); |
| 83 | davinci_cfg_reg(DM365_EMAC_RXD2); |
| 84 | davinci_cfg_reg(DM365_EMAC_RXD1); |
| 85 | davinci_cfg_reg(DM365_EMAC_RXD0); |
| 86 | davinci_cfg_reg(DM365_EMAC_RX_CLK); |
| 87 | davinci_cfg_reg(DM365_EMAC_RX_DV); |
| 88 | davinci_cfg_reg(DM365_EMAC_RX_ER); |
| 89 | davinci_cfg_reg(DM365_EMAC_CRS); |
| 90 | davinci_cfg_reg(DM365_EMAC_MDIO); |
| 91 | davinci_cfg_reg(DM365_EMAC_MDCLK); |
| 92 | |
| 93 | /* |
| 94 | * EMAC interrupts are multiplexed with GPIO interrupts |
| 95 | * Details are available at the DM365 ARM |
| 96 | * Subsystem Users Guide(sprufg5.pdf) pages 133 - 134 |
| 97 | */ |
| 98 | davinci_cfg_reg(DM365_INT_EMAC_RXTHRESH); |
| 99 | davinci_cfg_reg(DM365_INT_EMAC_RXPULSE); |
| 100 | davinci_cfg_reg(DM365_INT_EMAC_TXPULSE); |
| 101 | davinci_cfg_reg(DM365_INT_EMAC_MISCPULSE); |
| 102 | } |
| 103 | |
Sandeep Paulraj | a45c8ba | 2009-06-20 14:00:52 -0400 | [diff] [blame^] | 104 | static void dm365evm_mmc_configure(void) |
| 105 | { |
| 106 | /* |
| 107 | * MMC/SD pins are multiplexed with GPIO and EMIF |
| 108 | * Further details are available at the DM365 ARM |
| 109 | * Subsystem Users Guide(sprufg5.pdf) pages 118, 128 - 131 |
| 110 | */ |
| 111 | davinci_cfg_reg(DM365_SD1_CLK); |
| 112 | davinci_cfg_reg(DM365_SD1_CMD); |
| 113 | davinci_cfg_reg(DM365_SD1_DATA3); |
| 114 | davinci_cfg_reg(DM365_SD1_DATA2); |
| 115 | davinci_cfg_reg(DM365_SD1_DATA1); |
| 116 | davinci_cfg_reg(DM365_SD1_DATA0); |
| 117 | } |
| 118 | |
Sandeep Paulraj | 37dd009 | 2009-06-09 16:28:15 -0400 | [diff] [blame] | 119 | static void __init evm_init_i2c(void) |
| 120 | { |
| 121 | davinci_init_i2c(&i2c_pdata); |
Sandeep Paulraj | 8ed0a9d | 2009-06-20 12:23:39 -0400 | [diff] [blame] | 122 | i2c_register_board_info(1, i2c_info, ARRAY_SIZE(i2c_info)); |
Sandeep Paulraj | 37dd009 | 2009-06-09 16:28:15 -0400 | [diff] [blame] | 123 | } |
| 124 | |
| 125 | static struct davinci_uart_config uart_config __initdata = { |
| 126 | .enabled_uarts = (1 << 0), |
| 127 | }; |
| 128 | |
| 129 | static void __init dm365_evm_map_io(void) |
| 130 | { |
| 131 | dm365_init(); |
| 132 | } |
| 133 | |
| 134 | static __init void dm365_evm_init(void) |
| 135 | { |
Sandeep Paulraj | 8ed0a9d | 2009-06-20 12:23:39 -0400 | [diff] [blame] | 136 | struct davinci_soc_info *soc_info = &davinci_soc_info; |
| 137 | |
Sandeep Paulraj | 37dd009 | 2009-06-09 16:28:15 -0400 | [diff] [blame] | 138 | evm_init_i2c(); |
| 139 | davinci_serial_init(&uart_config); |
Sandeep Paulraj | 8ed0a9d | 2009-06-20 12:23:39 -0400 | [diff] [blame] | 140 | |
| 141 | dm365evm_emac_configure(); |
Sandeep Paulraj | a45c8ba | 2009-06-20 14:00:52 -0400 | [diff] [blame^] | 142 | dm365evm_mmc_configure(); |
| 143 | |
| 144 | davinci_setup_mmc(0, &dm365evm_mmc_config); |
| 145 | davinci_setup_mmc(1, &dm365evm_mmc_config); |
Sandeep Paulraj | 8ed0a9d | 2009-06-20 12:23:39 -0400 | [diff] [blame] | 146 | |
| 147 | soc_info->emac_pdata->phy_mask = DM365_EVM_PHY_MASK; |
| 148 | soc_info->emac_pdata->mdio_max_freq = DM365_EVM_MDIO_FREQUENCY; |
Sandeep Paulraj | 37dd009 | 2009-06-09 16:28:15 -0400 | [diff] [blame] | 149 | } |
| 150 | |
| 151 | static __init void dm365_evm_irq_init(void) |
| 152 | { |
| 153 | davinci_irq_init(); |
| 154 | } |
| 155 | |
| 156 | MACHINE_START(DAVINCI_DM365_EVM, "DaVinci DM365 EVM") |
| 157 | .phys_io = IO_PHYS, |
| 158 | .io_pg_offst = (__IO_ADDRESS(IO_PHYS) >> 18) & 0xfffc, |
| 159 | .boot_params = (0x80000100), |
| 160 | .map_io = dm365_evm_map_io, |
| 161 | .init_irq = dm365_evm_irq_init, |
| 162 | .timer = &davinci_timer, |
| 163 | .init_machine = dm365_evm_init, |
| 164 | MACHINE_END |
| 165 | |