Commit 28626632d83696ab3c8f2b9d5d8a658a1787551f

Authored by Magnus Damm
Committed by Paul Mundt
1 parent c6a389f123

ARM: mach-shmobile: Kota2 SCIFA2 and SMSC911X support

Kota2 base board support including the on-chip SCIFA2
serial console and the on-board SMSC911X ethernet port.

The s73a0 SMP bits are also updated to include Kota2.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>

Showing 4 changed files with 182 additions and 4 deletions Side-by-side Diff

arch/arm/mach-shmobile/Kconfig
... ... @@ -69,6 +69,11 @@
69 69 depends on ARCH_SH7372
70 70 select ARCH_REQUIRE_GPIOLIB
71 71  
  72 +config MACH_KOTA2
  73 + bool "KOTA2 board"
  74 + select ARCH_REQUIRE_GPIOLIB
  75 + depends on ARCH_SH73A0
  76 +
72 77 comment "SH-Mobile System Configuration"
73 78  
74 79 menu "Memory configuration"
... ... @@ -78,6 +83,7 @@
78 83 default "0x50000000" if MACH_G3EVM
79 84 default "0x40000000" if MACH_G4EVM || MACH_AP4EVB || MACH_AG5EVM || \
80 85 MACH_MACKEREL
  86 + default "0x41000000" if MACH_KOTA2
81 87 default "0x00000000"
82 88 ---help---
83 89 Tweak this only when porting to a new machine which does not
... ... @@ -89,6 +95,7 @@
89 95 default "0x08000000" if MACH_G3EVM
90 96 default "0x08000000" if MACH_G4EVM
91 97 default "0x20000000" if MACH_AG5EVM
  98 + default "0x1e000000" if MACH_KOTA2
92 99 default "0x10000000" if MACH_AP4EVB || MACH_MACKEREL
93 100 default "0x04000000"
94 101 help
arch/arm/mach-shmobile/Makefile
... ... @@ -41,6 +41,7 @@
41 41 obj-$(CONFIG_MACH_AP4EVB) += board-ap4evb.o
42 42 obj-$(CONFIG_MACH_AG5EVM) += board-ag5evm.o
43 43 obj-$(CONFIG_MACH_MACKEREL) += board-mackerel.o
  44 +obj-$(CONFIG_MACH_KOTA2) += board-kota2.o
44 45  
45 46 # Framework support
46 47 obj-$(CONFIG_SMP) += $(smp-y)
arch/arm/mach-shmobile/board-kota2.c
  1 +/*
  2 + * kota2 board support
  3 + *
  4 + * Copyright (C) 2011 Renesas Solutions Corp.
  5 + * Copyright (C) 2011 Magnus Damm
  6 + * Copyright (C) 2010 Takashi Yoshii <yoshii.takashi.zj@renesas.com>
  7 + * Copyright (C) 2009 Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
  8 + *
  9 + * This program is free software; you can redistribute it and/or modify
  10 + * it under the terms of the GNU General Public License as published by
  11 + * the Free Software Foundation; version 2 of the License.
  12 + *
  13 + * This program is distributed in the hope that it will be useful,
  14 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16 + * GNU General Public License for more details.
  17 + *
  18 + * You should have received a copy of the GNU General Public License
  19 + * along with this program; if not, write to the Free Software
  20 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  21 + */
  22 +
  23 +#include <linux/kernel.h>
  24 +#include <linux/init.h>
  25 +#include <linux/interrupt.h>
  26 +#include <linux/irq.h>
  27 +#include <linux/platform_device.h>
  28 +#include <linux/delay.h>
  29 +#include <linux/io.h>
  30 +#include <linux/smsc911x.h>
  31 +#include <linux/gpio.h>
  32 +#include <mach/hardware.h>
  33 +#include <mach/sh73a0.h>
  34 +#include <mach/common.h>
  35 +#include <asm/mach-types.h>
  36 +#include <asm/mach/arch.h>
  37 +#include <asm/mach/map.h>
  38 +#include <asm/mach/time.h>
  39 +#include <asm/hardware/gic.h>
  40 +#include <asm/hardware/cache-l2x0.h>
  41 +#include <asm/traps.h>
  42 +
  43 +static struct resource smsc9220_resources[] = {
  44 + [0] = {
  45 + .start = 0x14000000, /* CS5A */
  46 + .end = 0x140000ff, /* A1->A7 */
  47 + .flags = IORESOURCE_MEM,
  48 + },
  49 + [1] = {
  50 + .start = gic_spi(33), /* PINTA2 @ PORT144 */
  51 + .flags = IORESOURCE_IRQ,
  52 + },
  53 +};
  54 +
  55 +static struct smsc911x_platform_config smsc9220_platdata = {
  56 + .flags = SMSC911X_USE_32BIT, /* 32-bit SW on 16-bit HW bus */
  57 + .phy_interface = PHY_INTERFACE_MODE_MII,
  58 + .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
  59 + .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
  60 +};
  61 +
  62 +static struct platform_device eth_device = {
  63 + .name = "smsc911x",
  64 + .id = 0,
  65 + .dev = {
  66 + .platform_data = &smsc9220_platdata,
  67 + },
  68 + .resource = smsc9220_resources,
  69 + .num_resources = ARRAY_SIZE(smsc9220_resources),
  70 +};
  71 +
  72 +static struct platform_device *kota2_devices[] __initdata = {
  73 + &eth_device,
  74 +};
  75 +
  76 +static struct map_desc kota2_io_desc[] __initdata = {
  77 + /* create a 1:1 entity map for 0xe6xxxxxx
  78 + * used by CPGA, INTC and PFC.
  79 + */
  80 + {
  81 + .virtual = 0xe6000000,
  82 + .pfn = __phys_to_pfn(0xe6000000),
  83 + .length = 256 << 20,
  84 + .type = MT_DEVICE_NONSHARED
  85 + },
  86 +};
  87 +
  88 +static void __init kota2_map_io(void)
  89 +{
  90 + iotable_init(kota2_io_desc, ARRAY_SIZE(kota2_io_desc));
  91 +
  92 + /* setup early devices and console here as well */
  93 + sh73a0_add_early_devices();
  94 + shmobile_setup_console();
  95 +}
  96 +
  97 +#define PINTER0A 0xe69000a0
  98 +#define PINTCR0A 0xe69000b0
  99 +
  100 +void __init kota2_init_irq(void)
  101 +{
  102 + sh73a0_init_irq();
  103 +
  104 + /* setup PINT: enable PINTA2 as active low */
  105 + __raw_writel(1 << 29, PINTER0A);
  106 + __raw_writew(2 << 10, PINTCR0A);
  107 +}
  108 +
  109 +static void __init kota2_init(void)
  110 +{
  111 + sh73a0_pinmux_init();
  112 +
  113 + /* SCIFA2 (UART2) */
  114 + gpio_request(GPIO_FN_SCIFA2_TXD1, NULL);
  115 + gpio_request(GPIO_FN_SCIFA2_RXD1, NULL);
  116 + gpio_request(GPIO_FN_SCIFA2_RTS1_, NULL);
  117 + gpio_request(GPIO_FN_SCIFA2_CTS1_, NULL);
  118 +
  119 + /* SMSC911X */
  120 + gpio_request(GPIO_FN_D0_NAF0, NULL);
  121 + gpio_request(GPIO_FN_D1_NAF1, NULL);
  122 + gpio_request(GPIO_FN_D2_NAF2, NULL);
  123 + gpio_request(GPIO_FN_D3_NAF3, NULL);
  124 + gpio_request(GPIO_FN_D4_NAF4, NULL);
  125 + gpio_request(GPIO_FN_D5_NAF5, NULL);
  126 + gpio_request(GPIO_FN_D6_NAF6, NULL);
  127 + gpio_request(GPIO_FN_D7_NAF7, NULL);
  128 + gpio_request(GPIO_FN_D8_NAF8, NULL);
  129 + gpio_request(GPIO_FN_D9_NAF9, NULL);
  130 + gpio_request(GPIO_FN_D10_NAF10, NULL);
  131 + gpio_request(GPIO_FN_D11_NAF11, NULL);
  132 + gpio_request(GPIO_FN_D12_NAF12, NULL);
  133 + gpio_request(GPIO_FN_D13_NAF13, NULL);
  134 + gpio_request(GPIO_FN_D14_NAF14, NULL);
  135 + gpio_request(GPIO_FN_D15_NAF15, NULL);
  136 + gpio_request(GPIO_FN_CS5A_, NULL);
  137 + gpio_request(GPIO_FN_WE0__FWE, NULL);
  138 + gpio_request(GPIO_PORT144, NULL); /* PINTA2 */
  139 + gpio_direction_input(GPIO_PORT144);
  140 + gpio_request(GPIO_PORT145, NULL); /* RESET */
  141 + gpio_direction_output(GPIO_PORT145, 1);
  142 +
  143 +#ifdef CONFIG_CACHE_L2X0
  144 + /* Early BRESP enable, Shared attribute override enable, 64K*8way */
  145 + l2x0_init(__io(0xf0100000), 0x40460000, 0x82000fff);
  146 +#endif
  147 + sh73a0_add_standard_devices();
  148 + platform_add_devices(kota2_devices, ARRAY_SIZE(kota2_devices));
  149 +}
  150 +
  151 +static void __init kota2_timer_init(void)
  152 +{
  153 + sh73a0_clock_init();
  154 + shmobile_timer.init();
  155 + return;
  156 +}
  157 +
  158 +struct sys_timer kota2_timer = {
  159 + .init = kota2_timer_init,
  160 +};
  161 +
  162 +MACHINE_START(KOTA2, "kota2")
  163 + .map_io = kota2_map_io,
  164 + .init_irq = kota2_init_irq,
  165 + .handle_irq = shmobile_handle_irq_gic,
  166 + .init_machine = kota2_init,
  167 + .timer = &kota2_timer,
  168 +MACHINE_END
arch/arm/mach-shmobile/platsmp.c
... ... @@ -21,9 +21,11 @@
21 21 #include <asm/mach-types.h>
22 22 #include <mach/common.h>
23 23  
  24 +#define is_sh73a0() (machine_is_ag5evm() || machine_is_kota2())
  25 +
24 26 static unsigned int __init shmobile_smp_get_core_count(void)
25 27 {
26   - if (machine_is_ag5evm())
  28 + if (is_sh73a0())
27 29 return sh73a0_get_core_count();
28 30  
29 31 return 1;
... ... @@ -31,7 +33,7 @@
31 33  
32 34 static void __init shmobile_smp_prepare_cpus(void)
33 35 {
34   - if (machine_is_ag5evm())
  36 + if (is_sh73a0())
35 37 sh73a0_smp_prepare_cpus();
36 38 }
37 39  
38 40  
... ... @@ -39,13 +41,13 @@
39 41 {
40 42 trace_hardirqs_off();
41 43  
42   - if (machine_is_ag5evm())
  44 + if (is_sh73a0())
43 45 sh73a0_secondary_init(cpu);
44 46 }
45 47  
46 48 int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
47 49 {
48   - if (machine_is_ag5evm())
  50 + if (is_sh73a0())
49 51 return sh73a0_boot_secondary(cpu);
50 52  
51 53 return -ENOSYS;