Simon Horman | b8b82b2 | 2012-11-22 00:34:25 +0900 | [diff] [blame] | 1 | /* |
| 2 | * KZM-A9-GT board support - Reference Device Tree Implementation |
| 3 | * |
| 4 | * Copyright (C) 2012 Horms Solutions Ltd. |
| 5 | * |
| 6 | * Based on board-kzm9g.c |
| 7 | * Copyright (C) 2012 Kuninori Morimoto <kuninori.morimoto.gx@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/delay.h> |
| 24 | #include <linux/gpio.h> |
| 25 | #include <linux/io.h> |
| 26 | #include <linux/irq.h> |
| 27 | #include <linux/irqchip.h> |
| 28 | #include <linux/input.h> |
| 29 | #include <linux/of_platform.h> |
| 30 | #include <linux/pinctrl/machine.h> |
Guennadi Liakhovetski | f017d01 | 2013-02-08 19:38:27 +0100 | [diff] [blame] | 31 | #include <linux/pinctrl/pinconf-generic.h> |
Simon Horman | b8b82b2 | 2012-11-22 00:34:25 +0900 | [diff] [blame] | 32 | #include <mach/sh73a0.h> |
| 33 | #include <mach/common.h> |
| 34 | #include <asm/hardware/cache-l2x0.h> |
| 35 | #include <asm/mach-types.h> |
| 36 | #include <asm/mach/arch.h> |
| 37 | |
Guennadi Liakhovetski | f017d01 | 2013-02-08 19:38:27 +0100 | [diff] [blame] | 38 | static unsigned long pin_pullup_conf[] = { |
| 39 | PIN_CONF_PACKED(PIN_CONFIG_BIAS_PULL_UP, 0), |
| 40 | }; |
| 41 | |
Simon Horman | b8b82b2 | 2012-11-22 00:34:25 +0900 | [diff] [blame] | 42 | static const struct pinctrl_map kzm_pinctrl_map[] = { |
Guennadi Liakhovetski | a463f731 | 2013-03-19 18:38:50 +0100 | [diff] [blame] | 43 | PIN_MAP_MUX_GROUP_DEFAULT("e6826000.i2c", "pfc-sh73a0", |
Simon Horman | b8b82b2 | 2012-11-22 00:34:25 +0900 | [diff] [blame] | 44 | "i2c3_1", "i2c3"), |
Guennadi Liakhovetski | f017d01 | 2013-02-08 19:38:27 +0100 | [diff] [blame] | 45 | /* MMCIF */ |
Guennadi Liakhovetski | a463f731 | 2013-03-19 18:38:50 +0100 | [diff] [blame] | 46 | PIN_MAP_MUX_GROUP_DEFAULT("e6bd0000.mmcif", "pfc-sh73a0", |
Guennadi Liakhovetski | f017d01 | 2013-02-08 19:38:27 +0100 | [diff] [blame] | 47 | "mmc0_data8_0", "mmc0"), |
Guennadi Liakhovetski | a463f731 | 2013-03-19 18:38:50 +0100 | [diff] [blame] | 48 | PIN_MAP_MUX_GROUP_DEFAULT("e6bd0000.mmcif", "pfc-sh73a0", |
Guennadi Liakhovetski | f017d01 | 2013-02-08 19:38:27 +0100 | [diff] [blame] | 49 | "mmc0_ctrl_0", "mmc0"), |
Guennadi Liakhovetski | a463f731 | 2013-03-19 18:38:50 +0100 | [diff] [blame] | 50 | PIN_MAP_CONFIGS_PIN_DEFAULT("e6bd0000.mmcif", "pfc-sh73a0", |
Guennadi Liakhovetski | f017d01 | 2013-02-08 19:38:27 +0100 | [diff] [blame] | 51 | "PORT279", pin_pullup_conf), |
Guennadi Liakhovetski | a463f731 | 2013-03-19 18:38:50 +0100 | [diff] [blame] | 52 | PIN_MAP_CONFIGS_GROUP_DEFAULT("e6bd0000.mmcif", "pfc-sh73a0", |
Guennadi Liakhovetski | f017d01 | 2013-02-08 19:38:27 +0100 | [diff] [blame] | 53 | "mmc0_data8_0", pin_pullup_conf), |
| 54 | /* SCIFA4 */ |
Simon Horman | b8b82b2 | 2012-11-22 00:34:25 +0900 | [diff] [blame] | 55 | PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.4", "pfc-sh73a0", |
| 56 | "scifa4_data", "scifa4"), |
| 57 | PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.4", "pfc-sh73a0", |
| 58 | "scifa4_ctrl", "scifa4"), |
Guennadi Liakhovetski | f017d01 | 2013-02-08 19:38:27 +0100 | [diff] [blame] | 59 | /* SDHI0 */ |
Guennadi Liakhovetski | a463f731 | 2013-03-19 18:38:50 +0100 | [diff] [blame] | 60 | PIN_MAP_MUX_GROUP_DEFAULT("ee100000.sdhi", "pfc-sh73a0", |
Guennadi Liakhovetski | f017d01 | 2013-02-08 19:38:27 +0100 | [diff] [blame] | 61 | "sdhi0_data4", "sdhi0"), |
Guennadi Liakhovetski | a463f731 | 2013-03-19 18:38:50 +0100 | [diff] [blame] | 62 | PIN_MAP_MUX_GROUP_DEFAULT("ee100000.sdhi", "pfc-sh73a0", |
Guennadi Liakhovetski | f017d01 | 2013-02-08 19:38:27 +0100 | [diff] [blame] | 63 | "sdhi0_ctrl", "sdhi0"), |
Guennadi Liakhovetski | a463f731 | 2013-03-19 18:38:50 +0100 | [diff] [blame] | 64 | PIN_MAP_MUX_GROUP_DEFAULT("ee100000.sdhi", "pfc-sh73a0", |
Guennadi Liakhovetski | f017d01 | 2013-02-08 19:38:27 +0100 | [diff] [blame] | 65 | "sdhi0_cd", "sdhi0"), |
Guennadi Liakhovetski | a463f731 | 2013-03-19 18:38:50 +0100 | [diff] [blame] | 66 | PIN_MAP_MUX_GROUP_DEFAULT("ee100000.sdhi", "pfc-sh73a0", |
Guennadi Liakhovetski | f017d01 | 2013-02-08 19:38:27 +0100 | [diff] [blame] | 67 | "sdhi0_wp", "sdhi0"), |
| 68 | /* SDHI2 */ |
Guennadi Liakhovetski | a463f731 | 2013-03-19 18:38:50 +0100 | [diff] [blame] | 69 | PIN_MAP_MUX_GROUP_DEFAULT("ee140000.sdhi", "pfc-sh73a0", |
Guennadi Liakhovetski | f017d01 | 2013-02-08 19:38:27 +0100 | [diff] [blame] | 70 | "sdhi2_data4", "sdhi2"), |
Guennadi Liakhovetski | a463f731 | 2013-03-19 18:38:50 +0100 | [diff] [blame] | 71 | PIN_MAP_MUX_GROUP_DEFAULT("ee140000.sdhi", "pfc-sh73a0", |
Guennadi Liakhovetski | f017d01 | 2013-02-08 19:38:27 +0100 | [diff] [blame] | 72 | "sdhi2_ctrl", "sdhi2"), |
Simon Horman | b8b82b2 | 2012-11-22 00:34:25 +0900 | [diff] [blame] | 73 | }; |
| 74 | |
| 75 | static void __init kzm_init(void) |
| 76 | { |
| 77 | sh73a0_add_standard_devices_dt(); |
| 78 | pinctrl_register_mappings(kzm_pinctrl_map, ARRAY_SIZE(kzm_pinctrl_map)); |
Guennadi Liakhovetski | 275cc1d | 2013-02-08 19:38:31 +0100 | [diff] [blame] | 79 | sh73a0_pinmux_init(); |
Simon Horman | b8b82b2 | 2012-11-22 00:34:25 +0900 | [diff] [blame] | 80 | |
Guennadi Liakhovetski | f017d01 | 2013-02-08 19:38:27 +0100 | [diff] [blame] | 81 | /* enable SD */ |
Guennadi Liakhovetski | a463f731 | 2013-03-19 18:38:50 +0100 | [diff] [blame] | 82 | gpio_request_one(15, GPIOF_OUT_INIT_HIGH, NULL); /* power */ |
Guennadi Liakhovetski | f017d01 | 2013-02-08 19:38:27 +0100 | [diff] [blame] | 83 | |
Guennadi Liakhovetski | a463f731 | 2013-03-19 18:38:50 +0100 | [diff] [blame] | 84 | gpio_request_one(14, GPIOF_OUT_INIT_HIGH, NULL); /* power */ |
Guennadi Liakhovetski | f017d01 | 2013-02-08 19:38:27 +0100 | [diff] [blame] | 85 | |
Simon Horman | b8b82b2 | 2012-11-22 00:34:25 +0900 | [diff] [blame] | 86 | #ifdef CONFIG_CACHE_L2X0 |
| 87 | /* Early BRESP enable, Shared attribute override enable, 64K*8way */ |
| 88 | l2x0_init(IOMEM(0xf0100000), 0x40460000, 0x82000fff); |
| 89 | #endif |
| 90 | } |
| 91 | |
Simon Horman | b8b82b2 | 2012-11-22 00:34:25 +0900 | [diff] [blame] | 92 | static const char *kzm9g_boards_compat_dt[] __initdata = { |
| 93 | "renesas,kzm9g-reference", |
| 94 | NULL, |
| 95 | }; |
| 96 | |
Simon Horman | b8b82b2 | 2012-11-22 00:34:25 +0900 | [diff] [blame] | 97 | DT_MACHINE_START(KZM9G_DT, "kzm9g-reference") |
| 98 | .smp = smp_ops(sh73a0_smp_ops), |
| 99 | .map_io = sh73a0_map_io, |
| 100 | .init_early = sh73a0_init_delay, |
| 101 | .nr_irqs = NR_IRQS_LEGACY, |
| 102 | .init_irq = irqchip_init, |
| 103 | .init_machine = kzm_init, |
Simon Horman | b8b82b2 | 2012-11-22 00:34:25 +0900 | [diff] [blame] | 104 | .init_time = shmobile_timer_init, |
Simon Horman | b8b82b2 | 2012-11-22 00:34:25 +0900 | [diff] [blame] | 105 | .dt_compat = kzm9g_boards_compat_dt, |
| 106 | MACHINE_END |