Path: blob/master/arch/sh/boards/board-apsh4ad0a.c
10817 views
/*1* ALPHAPROJECT AP-SH4AD-0A Support.2*3* Copyright (C) 2010 ALPHAPROJECT Co.,Ltd.4* Copyright (C) 2010 Matt Fleming5* Copyright (C) 2010 Paul Mundt6*7* This file is subject to the terms and conditions of the GNU General Public8* License. See the file "COPYING" in the main directory of this archive9* for more details.10*/11#include <linux/init.h>12#include <linux/platform_device.h>13#include <linux/io.h>14#include <linux/smsc911x.h>15#include <linux/irq.h>16#include <linux/clk.h>17#include <asm/machvec.h>18#include <asm/sizes.h>1920static struct resource smsc911x_resources[] = {21[0] = {22.name = "smsc911x-memory",23.start = 0xA4000000,24.end = 0xA4000000 + SZ_256 - 1,25.flags = IORESOURCE_MEM,26},27[1] = {28.name = "smsc911x-irq",29.start = evt2irq(0x200),30.end = evt2irq(0x200),31.flags = IORESOURCE_IRQ,32},33};3435static struct smsc911x_platform_config smsc911x_config = {36.irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,37.irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,38.flags = SMSC911X_USE_16BIT,39.phy_interface = PHY_INTERFACE_MODE_MII,40};4142static struct platform_device smsc911x_device = {43.name = "smsc911x",44.id = -1,45.num_resources = ARRAY_SIZE(smsc911x_resources),46.resource = smsc911x_resources,47.dev = {48.platform_data = &smsc911x_config,49},50};5152static struct platform_device *apsh4ad0a_devices[] __initdata = {53&smsc911x_device,54};5556static int __init apsh4ad0a_devices_setup(void)57{58return platform_add_devices(apsh4ad0a_devices,59ARRAY_SIZE(apsh4ad0a_devices));60}61device_initcall(apsh4ad0a_devices_setup);6263static int apsh4ad0a_mode_pins(void)64{65int value = 0;6667/* These are the factory default settings of SW1 and SW2.68* If you change these dip switches then you will need to69* adjust the values below as well.70*/71value |= MODE_PIN0; /* Clock Mode 3 */72value |= MODE_PIN1;73value &= ~MODE_PIN2;74value &= ~MODE_PIN3;75value &= ~MODE_PIN4; /* 16-bit Area0 bus width */76value |= MODE_PIN5;77value |= MODE_PIN6;78value |= MODE_PIN7; /* Normal mode */79value |= MODE_PIN8; /* Little Endian */80value |= MODE_PIN9; /* Crystal resonator */81value &= ~MODE_PIN10; /* 29-bit address mode */82value &= ~MODE_PIN11; /* PCI-E Root port */83value &= ~MODE_PIN12; /* 4 lane + 1 lane */84value |= MODE_PIN13; /* AUD Enable */85value &= ~MODE_PIN14; /* Normal Operation */8687return value;88}8990static int apsh4ad0a_clk_init(void)91{92struct clk *clk;93int ret;9495clk = clk_get(NULL, "extal");96if (!clk || IS_ERR(clk))97return PTR_ERR(clk);98ret = clk_set_rate(clk, 33333000);99clk_put(clk);100101return ret;102}103104/* Initialize the board */105static void __init apsh4ad0a_setup(char **cmdline_p)106{107pr_info("Alpha Project AP-SH4AD-0A support:\n");108}109110static void __init apsh4ad0a_init_irq(void)111{112plat_irq_setup_pins(IRQ_MODE_IRQ3210);113}114115/*116* The Machine Vector117*/118static struct sh_machine_vector mv_apsh4ad0a __initmv = {119.mv_name = "AP-SH4AD-0A",120.mv_setup = apsh4ad0a_setup,121.mv_mode_pins = apsh4ad0a_mode_pins,122.mv_clk_init = apsh4ad0a_clk_init,123.mv_init_irq = apsh4ad0a_init_irq,124};125126127