Kuninori Morimoto | aaf9128 | 2018-12-28 00:31:46 -0800 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
Nobuhiro Iwamatsu | 32910e2 | 2009-03-17 05:54:37 +0000 | [diff] [blame] | 2 | /* |
Masanari Iida | 02582e9 | 2012-08-22 19:11:26 +0900 | [diff] [blame] | 3 | * Data Technology Inc. ESPT-GIGA board support |
Nobuhiro Iwamatsu | 32910e2 | 2009-03-17 05:54:37 +0000 | [diff] [blame] | 4 | * |
| 5 | * Copyright (C) 2008, 2009 Renesas Solutions Corp. |
| 6 | * Copyright (C) 2008, 2009 Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com> |
Nobuhiro Iwamatsu | 32910e2 | 2009-03-17 05:54:37 +0000 | [diff] [blame] | 7 | */ |
| 8 | #include <linux/init.h> |
| 9 | #include <linux/platform_device.h> |
| 10 | #include <linux/interrupt.h> |
| 11 | #include <linux/mtd/physmap.h> |
| 12 | #include <linux/io.h> |
Yoshihiro Shimoda | cf8e56b | 2011-09-28 16:49:14 +0900 | [diff] [blame] | 13 | #include <linux/sh_eth.h> |
Paul Mundt | d5d7e78 | 2012-05-18 14:57:21 +0900 | [diff] [blame] | 14 | #include <linux/sh_intc.h> |
Nobuhiro Iwamatsu | 32910e2 | 2009-03-17 05:54:37 +0000 | [diff] [blame] | 15 | #include <asm/machvec.h> |
Masahiro Yamada | 87dfb31 | 2019-05-14 15:46:51 -0700 | [diff] [blame] | 16 | #include <linux/sizes.h> |
Nobuhiro Iwamatsu | 32910e2 | 2009-03-17 05:54:37 +0000 | [diff] [blame] | 17 | |
| 18 | /* NOR Flash */ |
| 19 | static struct mtd_partition espt_nor_flash_partitions[] = { |
| 20 | { |
| 21 | .name = "U-Boot", |
| 22 | .offset = 0, |
| 23 | .size = (2 * SZ_128K), |
| 24 | .mask_flags = MTD_WRITEABLE, /* Read-only */ |
| 25 | }, { |
| 26 | .name = "Linux-Kernel", |
| 27 | .offset = MTDPART_OFS_APPEND, |
| 28 | .size = (20 * SZ_128K), |
| 29 | }, { |
| 30 | .name = "Root Filesystem", |
| 31 | .offset = MTDPART_OFS_APPEND, |
| 32 | .size = MTDPART_SIZ_FULL, |
| 33 | }, |
| 34 | }; |
| 35 | |
| 36 | static struct physmap_flash_data espt_nor_flash_data = { |
| 37 | .width = 2, |
| 38 | .parts = espt_nor_flash_partitions, |
| 39 | .nr_parts = ARRAY_SIZE(espt_nor_flash_partitions), |
| 40 | }; |
| 41 | |
| 42 | static struct resource espt_nor_flash_resources[] = { |
| 43 | [0] = { |
| 44 | .name = "NOR Flash", |
| 45 | .start = 0, |
| 46 | .end = SZ_8M - 1, |
| 47 | .flags = IORESOURCE_MEM, |
| 48 | }, |
| 49 | }; |
| 50 | |
| 51 | static struct platform_device espt_nor_flash_device = { |
| 52 | .name = "physmap-flash", |
| 53 | .resource = espt_nor_flash_resources, |
| 54 | .num_resources = ARRAY_SIZE(espt_nor_flash_resources), |
| 55 | .dev = { |
| 56 | .platform_data = &espt_nor_flash_data, |
| 57 | }, |
| 58 | }; |
| 59 | |
| 60 | /* SH-Ether */ |
| 61 | static struct resource sh_eth_resources[] = { |
| 62 | { |
| 63 | .start = 0xFEE00800, /* use eth1 */ |
| 64 | .end = 0xFEE00F7C - 1, |
| 65 | .flags = IORESOURCE_MEM, |
| 66 | }, { |
Yoshihiro Shimoda | 9055f89 | 2011-03-08 08:00:04 +0000 | [diff] [blame] | 67 | .start = 0xFEE01800, /* TSU */ |
| 68 | .end = 0xFEE01FFF, |
| 69 | .flags = IORESOURCE_MEM, |
| 70 | }, { |
| 71 | |
Paul Mundt | d5d7e78 | 2012-05-18 14:57:21 +0900 | [diff] [blame] | 72 | .start = evt2irq(0x920), /* irq number */ |
Nobuhiro Iwamatsu | 32910e2 | 2009-03-17 05:54:37 +0000 | [diff] [blame] | 73 | .flags = IORESOURCE_IRQ, |
| 74 | }, |
| 75 | }; |
| 76 | |
| 77 | static struct sh_eth_plat_data sh7763_eth_pdata = { |
| 78 | .phy = 0, |
Yoshihiro Shimoda | 9055f89 | 2011-03-08 08:00:04 +0000 | [diff] [blame] | 79 | .phy_interface = PHY_INTERFACE_MODE_MII, |
Nobuhiro Iwamatsu | 32910e2 | 2009-03-17 05:54:37 +0000 | [diff] [blame] | 80 | }; |
| 81 | |
| 82 | static struct platform_device espt_eth_device = { |
Sergei Shtylyov | f5d1276 | 2013-06-07 13:58:18 +0000 | [diff] [blame] | 83 | .name = "sh7763-gether", |
Nobuhiro Iwamatsu | 32910e2 | 2009-03-17 05:54:37 +0000 | [diff] [blame] | 84 | .resource = sh_eth_resources, |
| 85 | .num_resources = ARRAY_SIZE(sh_eth_resources), |
| 86 | .dev = { |
| 87 | .platform_data = &sh7763_eth_pdata, |
| 88 | }, |
| 89 | }; |
| 90 | |
| 91 | static struct platform_device *espt_devices[] __initdata = { |
| 92 | &espt_nor_flash_device, |
| 93 | &espt_eth_device, |
| 94 | }; |
| 95 | |
| 96 | static int __init espt_devices_setup(void) |
| 97 | { |
| 98 | return platform_add_devices(espt_devices, |
| 99 | ARRAY_SIZE(espt_devices)); |
| 100 | } |
| 101 | device_initcall(espt_devices_setup); |
| 102 | |
| 103 | static struct sh_machine_vector mv_espt __initmv = { |
| 104 | .mv_name = "ESPT-GIGA", |
| 105 | }; |