Christopher Moore | 0eb6697 | 2008-07-18 00:25:10 +0200 | [diff] [blame] | 1 | /* |
| 2 | * arch/arm/mach-orion5x/edmini_v2-setup.c |
| 3 | * |
| 4 | * LaCie Ethernet Disk mini V2 Setup |
| 5 | * |
| 6 | * Copyright (C) 2008 Christopher Moore <moore@free.fr> |
| 7 | * Copyright (C) 2008 Albert Aribaud <albert.aribaud@free.fr> |
| 8 | * |
| 9 | * This file is licensed under the terms of the GNU General Public |
| 10 | * License version 2. This program is licensed "as is" without any |
| 11 | * warranty of any kind, whether express or implied. |
| 12 | */ |
| 13 | |
| 14 | /* |
| 15 | * TODO: add Orion USB device port init when kernel.org support is added. |
| 16 | * TODO: add flash write support: see below. |
| 17 | * TODO: add power-off support. |
| 18 | * TODO: add I2C EEPROM support. |
| 19 | */ |
| 20 | |
| 21 | #include <linux/kernel.h> |
| 22 | #include <linux/init.h> |
| 23 | #include <linux/platform_device.h> |
| 24 | #include <linux/pci.h> |
| 25 | #include <linux/irq.h> |
Sebastian Hesselbarth | 497d3d0 | 2013-07-02 13:00:24 +0200 | [diff] [blame] | 26 | #include <linux/mbus.h> |
Christopher Moore | 0eb6697 | 2008-07-18 00:25:10 +0200 | [diff] [blame] | 27 | #include <linux/mtd/physmap.h> |
Albert Aribaud | 3d014b0 | 2008-09-19 21:06:25 +0200 | [diff] [blame] | 28 | #include <linux/leds.h> |
| 29 | #include <linux/gpio_keys.h> |
| 30 | #include <linux/input.h> |
Christopher Moore | 0eb6697 | 2008-07-18 00:25:10 +0200 | [diff] [blame] | 31 | #include <linux/i2c.h> |
| 32 | #include <linux/ata_platform.h> |
| 33 | #include <linux/gpio.h> |
| 34 | #include <asm/mach-types.h> |
| 35 | #include <asm/mach/arch.h> |
| 36 | #include <asm/mach/pci.h> |
| 37 | #include <mach/orion5x.h> |
| 38 | #include "common.h" |
| 39 | #include "mpp.h" |
| 40 | |
| 41 | /***************************************************************************** |
| 42 | * EDMINI_V2 Info |
| 43 | ****************************************************************************/ |
| 44 | |
| 45 | /* |
| 46 | * 512KB NOR flash Device bus boot chip select |
| 47 | */ |
| 48 | |
| 49 | #define EDMINI_V2_NOR_BOOT_BASE 0xfff80000 |
| 50 | #define EDMINI_V2_NOR_BOOT_SIZE SZ_512K |
| 51 | |
| 52 | /***************************************************************************** |
| 53 | * 512KB NOR Flash on BOOT Device |
| 54 | ****************************************************************************/ |
| 55 | |
| 56 | /* |
| 57 | * Currently the MTD code does not recognize the MX29LV400CBCT as a bottom |
| 58 | * -type device. This could cause risks of accidentally erasing critical |
| 59 | * flash sectors. We thus define a single, write-protected partition covering |
| 60 | * the whole flash. |
| 61 | * TODO: once the flash part TOP/BOTTOM detection issue is sorted out in the MTD |
| 62 | * code, break this into at least three partitions: 'u-boot code', 'u-boot |
| 63 | * environment' and 'whatever is left'. |
| 64 | */ |
| 65 | |
| 66 | static struct mtd_partition edmini_v2_partitions[] = { |
| 67 | { |
| 68 | .name = "Full512kb", |
| 69 | .size = 0x00080000, |
| 70 | .offset = 0x00000000, |
| 71 | .mask_flags = MTD_WRITEABLE, |
| 72 | }, |
| 73 | }; |
| 74 | |
| 75 | static struct physmap_flash_data edmini_v2_nor_flash_data = { |
| 76 | .width = 1, |
| 77 | .parts = edmini_v2_partitions, |
| 78 | .nr_parts = ARRAY_SIZE(edmini_v2_partitions), |
| 79 | }; |
| 80 | |
| 81 | static struct resource edmini_v2_nor_flash_resource = { |
| 82 | .flags = IORESOURCE_MEM, |
| 83 | .start = EDMINI_V2_NOR_BOOT_BASE, |
| 84 | .end = EDMINI_V2_NOR_BOOT_BASE |
| 85 | + EDMINI_V2_NOR_BOOT_SIZE - 1, |
| 86 | }; |
| 87 | |
| 88 | static struct platform_device edmini_v2_nor_flash = { |
| 89 | .name = "physmap-flash", |
| 90 | .id = 0, |
| 91 | .dev = { |
| 92 | .platform_data = &edmini_v2_nor_flash_data, |
| 93 | }, |
| 94 | .num_resources = 1, |
| 95 | .resource = &edmini_v2_nor_flash_resource, |
| 96 | }; |
| 97 | |
| 98 | /***************************************************************************** |
Christopher Moore | 0eb6697 | 2008-07-18 00:25:10 +0200 | [diff] [blame] | 99 | * General Setup |
| 100 | ****************************************************************************/ |
Christopher Moore | 0eb6697 | 2008-07-18 00:25:10 +0200 | [diff] [blame] | 101 | |
Thomas Petazzoni | 07f645d | 2012-11-16 16:39:46 +0100 | [diff] [blame] | 102 | void __init edmini_v2_init(void) |
Christopher Moore | 0eb6697 | 2008-07-18 00:25:10 +0200 | [diff] [blame] | 103 | { |
Christopher Moore | 0eb6697 | 2008-07-18 00:25:10 +0200 | [diff] [blame] | 104 | /* |
| 105 | * Configure peripherals. |
| 106 | */ |
| 107 | orion5x_ehci0_init(); |
Christopher Moore | 0eb6697 | 2008-07-18 00:25:10 +0200 | [diff] [blame] | 108 | |
Thomas Petazzoni | 4ca2c04 | 2013-07-26 10:17:42 -0300 | [diff] [blame] | 109 | mvebu_mbus_add_window_by_id(ORION_MBUS_DEVBUS_BOOT_TARGET, |
| 110 | ORION_MBUS_DEVBUS_BOOT_ATTR, |
| 111 | EDMINI_V2_NOR_BOOT_BASE, |
| 112 | EDMINI_V2_NOR_BOOT_SIZE); |
Christopher Moore | 0eb6697 | 2008-07-18 00:25:10 +0200 | [diff] [blame] | 113 | platform_device_register(&edmini_v2_nor_flash); |
Christopher Moore | 0eb6697 | 2008-07-18 00:25:10 +0200 | [diff] [blame] | 114 | |
| 115 | pr_notice("edmini_v2: USB device port, flash write and power-off " |
| 116 | "are not yet supported.\n"); |
Christopher Moore | 0eb6697 | 2008-07-18 00:25:10 +0200 | [diff] [blame] | 117 | } |