Path: blob/master/arch/arm/mach-exynos4/mach-armlex4210.c
10817 views
/* linux/arch/arm/mach-exynos4/mach-armlex4210.c1*2* Copyright (c) 2011 Samsung Electronics Co., Ltd.3* http://www.samsung.com4*5* This program is free software; you can redistribute it and/or modify6* it under the terms of the GNU General Public License version 2 as7* published by the Free Software Foundation.8*/910#include <linux/gpio.h>11#include <linux/io.h>12#include <linux/mmc/host.h>13#include <linux/platform_device.h>14#include <linux/serial_core.h>15#include <linux/smsc911x.h>1617#include <asm/mach/arch.h>18#include <asm/mach-types.h>1920#include <plat/cpu.h>21#include <plat/devs.h>22#include <plat/exynos4.h>23#include <plat/gpio-cfg.h>24#include <plat/regs-serial.h>25#include <plat/regs-srom.h>26#include <plat/sdhci.h>2728#include <mach/map.h>2930/* Following are default values for UCON, ULCON and UFCON UART registers */31#define ARMLEX4210_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \32S3C2410_UCON_RXILEVEL | \33S3C2410_UCON_TXIRQMODE | \34S3C2410_UCON_RXIRQMODE | \35S3C2410_UCON_RXFIFO_TOI | \36S3C2443_UCON_RXERR_IRQEN)3738#define ARMLEX4210_ULCON_DEFAULT S3C2410_LCON_CS83940#define ARMLEX4210_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \41S5PV210_UFCON_TXTRIG4 | \42S5PV210_UFCON_RXTRIG4)4344static struct s3c2410_uartcfg armlex4210_uartcfgs[] __initdata = {45[0] = {46.hwport = 0,47.flags = 0,48.ucon = ARMLEX4210_UCON_DEFAULT,49.ulcon = ARMLEX4210_ULCON_DEFAULT,50.ufcon = ARMLEX4210_UFCON_DEFAULT,51},52[1] = {53.hwport = 1,54.flags = 0,55.ucon = ARMLEX4210_UCON_DEFAULT,56.ulcon = ARMLEX4210_ULCON_DEFAULT,57.ufcon = ARMLEX4210_UFCON_DEFAULT,58},59[2] = {60.hwport = 2,61.flags = 0,62.ucon = ARMLEX4210_UCON_DEFAULT,63.ulcon = ARMLEX4210_ULCON_DEFAULT,64.ufcon = ARMLEX4210_UFCON_DEFAULT,65},66[3] = {67.hwport = 3,68.flags = 0,69.ucon = ARMLEX4210_UCON_DEFAULT,70.ulcon = ARMLEX4210_ULCON_DEFAULT,71.ufcon = ARMLEX4210_UFCON_DEFAULT,72},73};7475static struct s3c_sdhci_platdata armlex4210_hsmmc0_pdata __initdata = {76.cd_type = S3C_SDHCI_CD_PERMANENT,77.clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,78#ifdef CONFIG_EXYNOS4_SDHCI_CH0_8BIT79.max_width = 8,80.host_caps = MMC_CAP_8_BIT_DATA,81#endif82};8384static struct s3c_sdhci_platdata armlex4210_hsmmc2_pdata __initdata = {85.cd_type = S3C_SDHCI_CD_GPIO,86.ext_cd_gpio = EXYNOS4_GPX2(5),87.ext_cd_gpio_invert = 1,88.clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,89.max_width = 4,90};9192static struct s3c_sdhci_platdata armlex4210_hsmmc3_pdata __initdata = {93.cd_type = S3C_SDHCI_CD_PERMANENT,94.clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,95.max_width = 4,96};9798static void __init armlex4210_sdhci_init(void)99{100s3c_sdhci0_set_platdata(&armlex4210_hsmmc0_pdata);101s3c_sdhci2_set_platdata(&armlex4210_hsmmc2_pdata);102s3c_sdhci3_set_platdata(&armlex4210_hsmmc3_pdata);103}104105static void __init armlex4210_wlan_init(void)106{107/* enable */108s3c_gpio_cfgpin(EXYNOS4_GPX2(0), S3C_GPIO_SFN(0xf));109s3c_gpio_setpull(EXYNOS4_GPX2(0), S3C_GPIO_PULL_UP);110111/* reset */112s3c_gpio_cfgpin(EXYNOS4_GPX1(6), S3C_GPIO_SFN(0xf));113s3c_gpio_setpull(EXYNOS4_GPX1(6), S3C_GPIO_PULL_UP);114115/* wakeup */116s3c_gpio_cfgpin(EXYNOS4_GPX1(5), S3C_GPIO_SFN(0xf));117s3c_gpio_setpull(EXYNOS4_GPX1(5), S3C_GPIO_PULL_UP);118}119120static struct resource armlex4210_smsc911x_resources[] = {121[0] = {122.start = EXYNOS4_PA_SROM_BANK(3),123.end = EXYNOS4_PA_SROM_BANK(3) + SZ_64K - 1,124.flags = IORESOURCE_MEM,125},126[1] = {127.start = IRQ_EINT(27),128.end = IRQ_EINT(27),129.flags = IORESOURCE_IRQ | IRQF_TRIGGER_HIGH,130},131};132133static struct smsc911x_platform_config smsc9215_config = {134.irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,135.irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,136.flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY,137.phy_interface = PHY_INTERFACE_MODE_MII,138.mac = {0x00, 0x80, 0x00, 0x23, 0x45, 0x67},139};140141static struct platform_device armlex4210_smsc911x = {142.name = "smsc911x",143.id = -1,144.num_resources = ARRAY_SIZE(armlex4210_smsc911x_resources),145.resource = armlex4210_smsc911x_resources,146.dev = {147.platform_data = &smsc9215_config,148},149};150151static struct platform_device *armlex4210_devices[] __initdata = {152&s3c_device_hsmmc0,153&s3c_device_hsmmc2,154&s3c_device_hsmmc3,155&s3c_device_rtc,156&s3c_device_wdt,157&exynos4_device_sysmmu,158&samsung_asoc_dma,159&armlex4210_smsc911x,160&exynos4_device_ahci,161};162163static void __init armlex4210_smsc911x_init(void)164{165u32 cs1;166167/* configure nCS1 width to 16 bits */168cs1 = __raw_readl(S5P_SROM_BW) &169~(S5P_SROM_BW__CS_MASK << S5P_SROM_BW__NCS1__SHIFT);170cs1 |= ((1 << S5P_SROM_BW__DATAWIDTH__SHIFT) |171(0 << S5P_SROM_BW__WAITENABLE__SHIFT) |172(1 << S5P_SROM_BW__ADDRMODE__SHIFT) |173(1 << S5P_SROM_BW__BYTEENABLE__SHIFT)) <<174S5P_SROM_BW__NCS1__SHIFT;175__raw_writel(cs1, S5P_SROM_BW);176177/* set timing for nCS1 suitable for ethernet chip */178__raw_writel((0x1 << S5P_SROM_BCX__PMC__SHIFT) |179(0x9 << S5P_SROM_BCX__TACP__SHIFT) |180(0xc << S5P_SROM_BCX__TCAH__SHIFT) |181(0x1 << S5P_SROM_BCX__TCOH__SHIFT) |182(0x6 << S5P_SROM_BCX__TACC__SHIFT) |183(0x1 << S5P_SROM_BCX__TCOS__SHIFT) |184(0x1 << S5P_SROM_BCX__TACS__SHIFT), S5P_SROM_BC1);185}186187static void __init armlex4210_map_io(void)188{189s5p_init_io(NULL, 0, S5P_VA_CHIPID);190s3c24xx_init_clocks(24000000);191s3c24xx_init_uarts(armlex4210_uartcfgs,192ARRAY_SIZE(armlex4210_uartcfgs));193}194195static void __init armlex4210_machine_init(void)196{197armlex4210_smsc911x_init();198199armlex4210_sdhci_init();200201armlex4210_wlan_init();202203platform_add_devices(armlex4210_devices,204ARRAY_SIZE(armlex4210_devices));205}206207MACHINE_START(ARMLEX4210, "ARMLEX4210")208/* Maintainer: Alim Akhtar <[email protected]> */209.boot_params = S5P_PA_SDRAM + 0x100,210.init_irq = exynos4_init_irq,211.map_io = armlex4210_map_io,212.init_machine = armlex4210_machine_init,213.timer = &exynos4_timer,214MACHINE_END215216217