18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * linux/arch/sh/boards/magicpanel/setup.c 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 2007 Markus Brunner, Mark Jonas 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * Magic Panel Release 2 board setup 88c2ecf20Sopenharmony_ci */ 98c2ecf20Sopenharmony_ci#include <linux/init.h> 108c2ecf20Sopenharmony_ci#include <linux/irq.h> 118c2ecf20Sopenharmony_ci#include <linux/platform_device.h> 128c2ecf20Sopenharmony_ci#include <linux/delay.h> 138c2ecf20Sopenharmony_ci#include <linux/gpio.h> 148c2ecf20Sopenharmony_ci#include <linux/regulator/fixed.h> 158c2ecf20Sopenharmony_ci#include <linux/regulator/machine.h> 168c2ecf20Sopenharmony_ci#include <linux/smsc911x.h> 178c2ecf20Sopenharmony_ci#include <linux/mtd/mtd.h> 188c2ecf20Sopenharmony_ci#include <linux/mtd/partitions.h> 198c2ecf20Sopenharmony_ci#include <linux/mtd/physmap.h> 208c2ecf20Sopenharmony_ci#include <linux/mtd/map.h> 218c2ecf20Sopenharmony_ci#include <linux/sh_intc.h> 228c2ecf20Sopenharmony_ci#include <mach/magicpanelr2.h> 238c2ecf20Sopenharmony_ci#include <asm/heartbeat.h> 248c2ecf20Sopenharmony_ci#include <cpu/sh7720.h> 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci/* Dummy supplies, where voltage doesn't matter */ 278c2ecf20Sopenharmony_cistatic struct regulator_consumer_supply dummy_supplies[] = { 288c2ecf20Sopenharmony_ci REGULATOR_SUPPLY("vddvario", "smsc911x"), 298c2ecf20Sopenharmony_ci REGULATOR_SUPPLY("vdd33a", "smsc911x"), 308c2ecf20Sopenharmony_ci}; 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci#define LAN9115_READY (__raw_readl(0xA8000084UL) & 0x00000001UL) 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci/* Wait until reset finished. Timeout is 100ms. */ 358c2ecf20Sopenharmony_cistatic int __init ethernet_reset_finished(void) 368c2ecf20Sopenharmony_ci{ 378c2ecf20Sopenharmony_ci int i; 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci if (LAN9115_READY) 408c2ecf20Sopenharmony_ci return 1; 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci for (i = 0; i < 10; ++i) { 438c2ecf20Sopenharmony_ci mdelay(10); 448c2ecf20Sopenharmony_ci if (LAN9115_READY) 458c2ecf20Sopenharmony_ci return 1; 468c2ecf20Sopenharmony_ci } 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci return 0; 498c2ecf20Sopenharmony_ci} 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_cistatic void __init reset_ethernet(void) 528c2ecf20Sopenharmony_ci{ 538c2ecf20Sopenharmony_ci /* PMDR: LAN_RESET=on */ 548c2ecf20Sopenharmony_ci CLRBITS_OUTB(0x10, PORT_PMDR); 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci udelay(200); 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_ci /* PMDR: LAN_RESET=off */ 598c2ecf20Sopenharmony_ci SETBITS_OUTB(0x10, PORT_PMDR); 608c2ecf20Sopenharmony_ci} 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_cistatic void __init setup_chip_select(void) 638c2ecf20Sopenharmony_ci{ 648c2ecf20Sopenharmony_ci /* CS2: LAN (0x08000000 - 0x0bffffff) */ 658c2ecf20Sopenharmony_ci /* no idle cycles, normal space, 8 bit data bus */ 668c2ecf20Sopenharmony_ci __raw_writel(0x36db0400, CS2BCR); 678c2ecf20Sopenharmony_ci /* (SW:1.5 WR:3 HW:1.5), ext. wait */ 688c2ecf20Sopenharmony_ci __raw_writel(0x000003c0, CS2WCR); 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_ci /* CS4: CAN1 (0xb0000000 - 0xb3ffffff) */ 718c2ecf20Sopenharmony_ci /* no idle cycles, normal space, 8 bit data bus */ 728c2ecf20Sopenharmony_ci __raw_writel(0x00000200, CS4BCR); 738c2ecf20Sopenharmony_ci /* (SW:1.5 WR:3 HW:1.5), ext. wait */ 748c2ecf20Sopenharmony_ci __raw_writel(0x00100981, CS4WCR); 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ci /* CS5a: CAN2 (0xb4000000 - 0xb5ffffff) */ 778c2ecf20Sopenharmony_ci /* no idle cycles, normal space, 8 bit data bus */ 788c2ecf20Sopenharmony_ci __raw_writel(0x00000200, CS5ABCR); 798c2ecf20Sopenharmony_ci /* (SW:1.5 WR:3 HW:1.5), ext. wait */ 808c2ecf20Sopenharmony_ci __raw_writel(0x00100981, CS5AWCR); 818c2ecf20Sopenharmony_ci 828c2ecf20Sopenharmony_ci /* CS5b: CAN3 (0xb6000000 - 0xb7ffffff) */ 838c2ecf20Sopenharmony_ci /* no idle cycles, normal space, 8 bit data bus */ 848c2ecf20Sopenharmony_ci __raw_writel(0x00000200, CS5BBCR); 858c2ecf20Sopenharmony_ci /* (SW:1.5 WR:3 HW:1.5), ext. wait */ 868c2ecf20Sopenharmony_ci __raw_writel(0x00100981, CS5BWCR); 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_ci /* CS6a: Rotary (0xb8000000 - 0xb9ffffff) */ 898c2ecf20Sopenharmony_ci /* no idle cycles, normal space, 8 bit data bus */ 908c2ecf20Sopenharmony_ci __raw_writel(0x00000200, CS6ABCR); 918c2ecf20Sopenharmony_ci /* (SW:1.5 WR:3 HW:1.5), no ext. wait */ 928c2ecf20Sopenharmony_ci __raw_writel(0x001009C1, CS6AWCR); 938c2ecf20Sopenharmony_ci} 948c2ecf20Sopenharmony_ci 958c2ecf20Sopenharmony_cistatic void __init setup_port_multiplexing(void) 968c2ecf20Sopenharmony_ci{ 978c2ecf20Sopenharmony_ci /* A7 GPO(LED8); A6 GPO(LED7); A5 GPO(LED6); A4 GPO(LED5); 988c2ecf20Sopenharmony_ci * A3 GPO(LED4); A2 GPO(LED3); A1 GPO(LED2); A0 GPO(LED1); 998c2ecf20Sopenharmony_ci */ 1008c2ecf20Sopenharmony_ci __raw_writew(0x5555, PORT_PACR); /* 01 01 01 01 01 01 01 01 */ 1018c2ecf20Sopenharmony_ci 1028c2ecf20Sopenharmony_ci /* B7 GPO(RST4); B6 GPO(RST3); B5 GPO(RST2); B4 GPO(RST1); 1038c2ecf20Sopenharmony_ci * B3 GPO(PB3); B2 GPO(PB2); B1 GPO(PB1); B0 GPO(PB0); 1048c2ecf20Sopenharmony_ci */ 1058c2ecf20Sopenharmony_ci __raw_writew(0x5555, PORT_PBCR); /* 01 01 01 01 01 01 01 01 */ 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ci /* C7 GPO(PC7); C6 GPO(PC6); C5 GPO(PC5); C4 GPO(PC4); 1088c2ecf20Sopenharmony_ci * C3 LCD_DATA3; C2 LCD_DATA2; C1 LCD_DATA1; C0 LCD_DATA0; 1098c2ecf20Sopenharmony_ci */ 1108c2ecf20Sopenharmony_ci __raw_writew(0x5500, PORT_PCCR); /* 01 01 01 01 00 00 00 00 */ 1118c2ecf20Sopenharmony_ci 1128c2ecf20Sopenharmony_ci /* D7 GPO(PD7); D6 GPO(PD6); D5 GPO(PD5); D4 GPO(PD4); 1138c2ecf20Sopenharmony_ci * D3 GPO(PD3); D2 GPO(PD2); D1 GPO(PD1); D0 GPO(PD0); 1148c2ecf20Sopenharmony_ci */ 1158c2ecf20Sopenharmony_ci __raw_writew(0x5555, PORT_PDCR); /* 01 01 01 01 01 01 01 01 */ 1168c2ecf20Sopenharmony_ci 1178c2ecf20Sopenharmony_ci /* E7 (x); E6 GPI(nu); E5 GPI(nu); E4 LCD_M_DISP; 1188c2ecf20Sopenharmony_ci * E3 LCD_CL1; E2 LCD_CL2; E1 LCD_DON; E0 LCD_FLM; 1198c2ecf20Sopenharmony_ci */ 1208c2ecf20Sopenharmony_ci __raw_writew(0x3C00, PORT_PECR); /* 00 11 11 00 00 00 00 00 */ 1218c2ecf20Sopenharmony_ci 1228c2ecf20Sopenharmony_ci /* F7 (x); F6 DA1(VLCD); F5 DA0(nc); F4 AN3; 1238c2ecf20Sopenharmony_ci * F3 AN2(MID_AD); F2 AN1(EARTH_AD); F1 AN0(TEMP); F0 GPI+(nc); 1248c2ecf20Sopenharmony_ci */ 1258c2ecf20Sopenharmony_ci __raw_writew(0x0002, PORT_PFCR); /* 00 00 00 00 00 00 00 10 */ 1268c2ecf20Sopenharmony_ci 1278c2ecf20Sopenharmony_ci /* G7 (x); G6 IRQ5(TOUCH_BUSY); G5 IRQ4(TOUCH_IRQ); G4 GPI(KEY2); 1288c2ecf20Sopenharmony_ci * G3 GPI(KEY1); G2 GPO(LED11); G1 GPO(LED10); G0 GPO(LED9); 1298c2ecf20Sopenharmony_ci */ 1308c2ecf20Sopenharmony_ci __raw_writew(0x03D5, PORT_PGCR); /* 00 00 00 11 11 01 01 01 */ 1318c2ecf20Sopenharmony_ci 1328c2ecf20Sopenharmony_ci /* H7 (x); H6 /RAS(BRAS); H5 /CAS(BCAS); H4 CKE(BCKE); 1338c2ecf20Sopenharmony_ci * H3 GPO(EARTH_OFF); H2 GPO(EARTH_TEST); H1 USB2_PWR; H0 USB1_PWR; 1348c2ecf20Sopenharmony_ci */ 1358c2ecf20Sopenharmony_ci __raw_writew(0x0050, PORT_PHCR); /* 00 00 00 00 01 01 00 00 */ 1368c2ecf20Sopenharmony_ci 1378c2ecf20Sopenharmony_ci /* J7 (x); J6 AUDCK; J5 ASEBRKAK; J4 AUDATA3; 1388c2ecf20Sopenharmony_ci * J3 AUDATA2; J2 AUDATA1; J1 AUDATA0; J0 AUDSYNC; 1398c2ecf20Sopenharmony_ci */ 1408c2ecf20Sopenharmony_ci __raw_writew(0x0000, PORT_PJCR); /* 00 00 00 00 00 00 00 00 */ 1418c2ecf20Sopenharmony_ci 1428c2ecf20Sopenharmony_ci /* K7 (x); K6 (x); K5 (x); K4 (x); 1438c2ecf20Sopenharmony_ci * K3 PINT7(/PWR2); K2 PINT6(/PWR1); K1 PINT5(nu); K0 PINT4(FLASH_READY) 1448c2ecf20Sopenharmony_ci */ 1458c2ecf20Sopenharmony_ci __raw_writew(0x00FF, PORT_PKCR); /* 00 00 00 00 11 11 11 11 */ 1468c2ecf20Sopenharmony_ci 1478c2ecf20Sopenharmony_ci /* L7 TRST; L6 TMS; L5 TDO; L4 TDI; 1488c2ecf20Sopenharmony_ci * L3 TCK; L2 (x); L1 (x); L0 (x); 1498c2ecf20Sopenharmony_ci */ 1508c2ecf20Sopenharmony_ci __raw_writew(0x0000, PORT_PLCR); /* 00 00 00 00 00 00 00 00 */ 1518c2ecf20Sopenharmony_ci 1528c2ecf20Sopenharmony_ci /* M7 GPO(CURRENT_SINK); M6 GPO(PWR_SWITCH); M5 GPO(LAN_SPEED); 1538c2ecf20Sopenharmony_ci * M4 GPO(LAN_RESET); M3 GPO(BUZZER); M2 GPO(LCD_BL); 1548c2ecf20Sopenharmony_ci * M1 CS5B(CAN3_CS); M0 GPI+(nc); 1558c2ecf20Sopenharmony_ci */ 1568c2ecf20Sopenharmony_ci __raw_writew(0x5552, PORT_PMCR); /* 01 01 01 01 01 01 00 10 */ 1578c2ecf20Sopenharmony_ci 1588c2ecf20Sopenharmony_ci /* CURRENT_SINK=off, PWR_SWITCH=off, LAN_SPEED=100MBit, 1598c2ecf20Sopenharmony_ci * LAN_RESET=off, BUZZER=off, LCD_BL=off 1608c2ecf20Sopenharmony_ci */ 1618c2ecf20Sopenharmony_ci#if CONFIG_SH_MAGIC_PANEL_R2_VERSION == 2 1628c2ecf20Sopenharmony_ci __raw_writeb(0x30, PORT_PMDR); 1638c2ecf20Sopenharmony_ci#elif CONFIG_SH_MAGIC_PANEL_R2_VERSION == 3 1648c2ecf20Sopenharmony_ci __raw_writeb(0xF0, PORT_PMDR); 1658c2ecf20Sopenharmony_ci#else 1668c2ecf20Sopenharmony_ci#error Unknown revision of PLATFORM_MP_R2 1678c2ecf20Sopenharmony_ci#endif 1688c2ecf20Sopenharmony_ci 1698c2ecf20Sopenharmony_ci /* P7 (x); P6 (x); P5 (x); 1708c2ecf20Sopenharmony_ci * P4 GPO(nu); P3 IRQ3(LAN_IRQ); P2 IRQ2(CAN3_IRQ); 1718c2ecf20Sopenharmony_ci * P1 IRQ1(CAN2_IRQ); P0 IRQ0(CAN1_IRQ) 1728c2ecf20Sopenharmony_ci */ 1738c2ecf20Sopenharmony_ci __raw_writew(0x0100, PORT_PPCR); /* 00 00 00 01 00 00 00 00 */ 1748c2ecf20Sopenharmony_ci __raw_writeb(0x10, PORT_PPDR); 1758c2ecf20Sopenharmony_ci 1768c2ecf20Sopenharmony_ci /* R7 A25; R6 A24; R5 A23; R4 A22; 1778c2ecf20Sopenharmony_ci * R3 A21; R2 A20; R1 A19; R0 A0; 1788c2ecf20Sopenharmony_ci */ 1798c2ecf20Sopenharmony_ci gpio_request(GPIO_FN_A25, NULL); 1808c2ecf20Sopenharmony_ci gpio_request(GPIO_FN_A24, NULL); 1818c2ecf20Sopenharmony_ci gpio_request(GPIO_FN_A23, NULL); 1828c2ecf20Sopenharmony_ci gpio_request(GPIO_FN_A22, NULL); 1838c2ecf20Sopenharmony_ci gpio_request(GPIO_FN_A21, NULL); 1848c2ecf20Sopenharmony_ci gpio_request(GPIO_FN_A20, NULL); 1858c2ecf20Sopenharmony_ci gpio_request(GPIO_FN_A19, NULL); 1868c2ecf20Sopenharmony_ci gpio_request(GPIO_FN_A0, NULL); 1878c2ecf20Sopenharmony_ci 1888c2ecf20Sopenharmony_ci /* S7 (x); S6 (x); S5 (x); S4 GPO(EEPROM_CS2); 1898c2ecf20Sopenharmony_ci * S3 GPO(EEPROM_CS1); S2 SIOF0_TXD; S1 SIOF0_RXD; S0 SIOF0_SCK; 1908c2ecf20Sopenharmony_ci */ 1918c2ecf20Sopenharmony_ci __raw_writew(0x0140, PORT_PSCR); /* 00 00 00 01 01 00 00 00 */ 1928c2ecf20Sopenharmony_ci 1938c2ecf20Sopenharmony_ci /* T7 (x); T6 (x); T5 (x); T4 COM1_CTS; 1948c2ecf20Sopenharmony_ci * T3 COM1_RTS; T2 COM1_TXD; T1 COM1_RXD; T0 GPO(WDOG) 1958c2ecf20Sopenharmony_ci */ 1968c2ecf20Sopenharmony_ci __raw_writew(0x0001, PORT_PTCR); /* 00 00 00 00 00 00 00 01 */ 1978c2ecf20Sopenharmony_ci 1988c2ecf20Sopenharmony_ci /* U7 (x); U6 (x); U5 (x); U4 GPI+(/AC_FAULT); 1998c2ecf20Sopenharmony_ci * U3 GPO(TOUCH_CS); U2 TOUCH_TXD; U1 TOUCH_RXD; U0 TOUCH_SCK; 2008c2ecf20Sopenharmony_ci */ 2018c2ecf20Sopenharmony_ci __raw_writew(0x0240, PORT_PUCR); /* 00 00 00 10 01 00 00 00 */ 2028c2ecf20Sopenharmony_ci 2038c2ecf20Sopenharmony_ci /* V7 (x); V6 (x); V5 (x); V4 GPO(MID2); 2048c2ecf20Sopenharmony_ci * V3 GPO(MID1); V2 CARD_TxD; V1 CARD_RxD; V0 GPI+(/BAT_FAULT); 2058c2ecf20Sopenharmony_ci */ 2068c2ecf20Sopenharmony_ci __raw_writew(0x0142, PORT_PVCR); /* 00 00 00 01 01 00 00 10 */ 2078c2ecf20Sopenharmony_ci} 2088c2ecf20Sopenharmony_ci 2098c2ecf20Sopenharmony_cistatic void __init mpr2_setup(char **cmdline_p) 2108c2ecf20Sopenharmony_ci{ 2118c2ecf20Sopenharmony_ci /* set Pin Select Register A: 2128c2ecf20Sopenharmony_ci * /PCC_CD1, /PCC_CD2, PCC_BVD1, PCC_BVD2, 2138c2ecf20Sopenharmony_ci * /IOIS16, IRQ4, IRQ5, USB1d_SUSPEND 2148c2ecf20Sopenharmony_ci */ 2158c2ecf20Sopenharmony_ci __raw_writew(0xAABC, PORT_PSELA); 2168c2ecf20Sopenharmony_ci /* set Pin Select Register B: 2178c2ecf20Sopenharmony_ci * /SCIF0_RTS, /SCIF0_CTS, LCD_VCPWC, 2188c2ecf20Sopenharmony_ci * LCD_VEPWC, IIC_SDA, IIC_SCL, Reserved 2198c2ecf20Sopenharmony_ci */ 2208c2ecf20Sopenharmony_ci __raw_writew(0x3C00, PORT_PSELB); 2218c2ecf20Sopenharmony_ci /* set Pin Select Register C: 2228c2ecf20Sopenharmony_ci * SIOF1_SCK, SIOF1_RxD, SCIF1_RxD, SCIF1_TxD, Reserved 2238c2ecf20Sopenharmony_ci */ 2248c2ecf20Sopenharmony_ci __raw_writew(0x0000, PORT_PSELC); 2258c2ecf20Sopenharmony_ci /* set Pin Select Register D: Reserved, SIOF1_TxD, Reserved, SIOF1_MCLK, 2268c2ecf20Sopenharmony_ci * Reserved, SIOF1_SYNC, Reserved, SCIF1_SCK, Reserved 2278c2ecf20Sopenharmony_ci */ 2288c2ecf20Sopenharmony_ci __raw_writew(0x0000, PORT_PSELD); 2298c2ecf20Sopenharmony_ci /* set USB TxRx Control: Reserved, DRV, Reserved, USB_TRANS, USB_SEL */ 2308c2ecf20Sopenharmony_ci __raw_writew(0x0101, PORT_UTRCTL); 2318c2ecf20Sopenharmony_ci /* set USB Clock Control: USSCS, USSTB, Reserved (HighByte always A5) */ 2328c2ecf20Sopenharmony_ci __raw_writew(0xA5C0, PORT_UCLKCR_W); 2338c2ecf20Sopenharmony_ci 2348c2ecf20Sopenharmony_ci setup_chip_select(); 2358c2ecf20Sopenharmony_ci 2368c2ecf20Sopenharmony_ci setup_port_multiplexing(); 2378c2ecf20Sopenharmony_ci 2388c2ecf20Sopenharmony_ci reset_ethernet(); 2398c2ecf20Sopenharmony_ci 2408c2ecf20Sopenharmony_ci printk(KERN_INFO "Magic Panel Release 2 A.%i\n", 2418c2ecf20Sopenharmony_ci CONFIG_SH_MAGIC_PANEL_R2_VERSION); 2428c2ecf20Sopenharmony_ci 2438c2ecf20Sopenharmony_ci if (ethernet_reset_finished() == 0) 2448c2ecf20Sopenharmony_ci printk(KERN_WARNING "Ethernet not ready\n"); 2458c2ecf20Sopenharmony_ci} 2468c2ecf20Sopenharmony_ci 2478c2ecf20Sopenharmony_cistatic struct resource smsc911x_resources[] = { 2488c2ecf20Sopenharmony_ci [0] = { 2498c2ecf20Sopenharmony_ci .start = 0xa8000000, 2508c2ecf20Sopenharmony_ci .end = 0xabffffff, 2518c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 2528c2ecf20Sopenharmony_ci }, 2538c2ecf20Sopenharmony_ci [1] = { 2548c2ecf20Sopenharmony_ci .start = evt2irq(0x660), 2558c2ecf20Sopenharmony_ci .end = evt2irq(0x660), 2568c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 2578c2ecf20Sopenharmony_ci }, 2588c2ecf20Sopenharmony_ci}; 2598c2ecf20Sopenharmony_ci 2608c2ecf20Sopenharmony_cistatic struct smsc911x_platform_config smsc911x_config = { 2618c2ecf20Sopenharmony_ci .phy_interface = PHY_INTERFACE_MODE_MII, 2628c2ecf20Sopenharmony_ci .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, 2638c2ecf20Sopenharmony_ci .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, 2648c2ecf20Sopenharmony_ci .flags = SMSC911X_USE_32BIT, 2658c2ecf20Sopenharmony_ci}; 2668c2ecf20Sopenharmony_ci 2678c2ecf20Sopenharmony_cistatic struct platform_device smsc911x_device = { 2688c2ecf20Sopenharmony_ci .name = "smsc911x", 2698c2ecf20Sopenharmony_ci .id = -1, 2708c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(smsc911x_resources), 2718c2ecf20Sopenharmony_ci .resource = smsc911x_resources, 2728c2ecf20Sopenharmony_ci .dev = { 2738c2ecf20Sopenharmony_ci .platform_data = &smsc911x_config, 2748c2ecf20Sopenharmony_ci }, 2758c2ecf20Sopenharmony_ci}; 2768c2ecf20Sopenharmony_ci 2778c2ecf20Sopenharmony_cistatic struct resource heartbeat_resources[] = { 2788c2ecf20Sopenharmony_ci [0] = { 2798c2ecf20Sopenharmony_ci .start = PA_LED, 2808c2ecf20Sopenharmony_ci .end = PA_LED, 2818c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 2828c2ecf20Sopenharmony_ci }, 2838c2ecf20Sopenharmony_ci}; 2848c2ecf20Sopenharmony_ci 2858c2ecf20Sopenharmony_cistatic struct heartbeat_data heartbeat_data = { 2868c2ecf20Sopenharmony_ci .flags = HEARTBEAT_INVERTED, 2878c2ecf20Sopenharmony_ci}; 2888c2ecf20Sopenharmony_ci 2898c2ecf20Sopenharmony_cistatic struct platform_device heartbeat_device = { 2908c2ecf20Sopenharmony_ci .name = "heartbeat", 2918c2ecf20Sopenharmony_ci .id = -1, 2928c2ecf20Sopenharmony_ci .dev = { 2938c2ecf20Sopenharmony_ci .platform_data = &heartbeat_data, 2948c2ecf20Sopenharmony_ci }, 2958c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(heartbeat_resources), 2968c2ecf20Sopenharmony_ci .resource = heartbeat_resources, 2978c2ecf20Sopenharmony_ci}; 2988c2ecf20Sopenharmony_ci 2998c2ecf20Sopenharmony_cistatic struct mtd_partition mpr2_partitions[] = { 3008c2ecf20Sopenharmony_ci /* Reserved for bootloader, read-only */ 3018c2ecf20Sopenharmony_ci { 3028c2ecf20Sopenharmony_ci .name = "Bootloader", 3038c2ecf20Sopenharmony_ci .offset = 0x00000000UL, 3048c2ecf20Sopenharmony_ci .size = MPR2_MTD_BOOTLOADER_SIZE, 3058c2ecf20Sopenharmony_ci .mask_flags = MTD_WRITEABLE, 3068c2ecf20Sopenharmony_ci }, 3078c2ecf20Sopenharmony_ci /* Reserved for kernel image */ 3088c2ecf20Sopenharmony_ci { 3098c2ecf20Sopenharmony_ci .name = "Kernel", 3108c2ecf20Sopenharmony_ci .offset = MTDPART_OFS_NXTBLK, 3118c2ecf20Sopenharmony_ci .size = MPR2_MTD_KERNEL_SIZE, 3128c2ecf20Sopenharmony_ci }, 3138c2ecf20Sopenharmony_ci /* Rest is used for Flash FS */ 3148c2ecf20Sopenharmony_ci { 3158c2ecf20Sopenharmony_ci .name = "Flash_FS", 3168c2ecf20Sopenharmony_ci .offset = MTDPART_OFS_NXTBLK, 3178c2ecf20Sopenharmony_ci .size = MTDPART_SIZ_FULL, 3188c2ecf20Sopenharmony_ci } 3198c2ecf20Sopenharmony_ci}; 3208c2ecf20Sopenharmony_ci 3218c2ecf20Sopenharmony_cistatic struct physmap_flash_data flash_data = { 3228c2ecf20Sopenharmony_ci .parts = mpr2_partitions, 3238c2ecf20Sopenharmony_ci .nr_parts = ARRAY_SIZE(mpr2_partitions), 3248c2ecf20Sopenharmony_ci .width = 2, 3258c2ecf20Sopenharmony_ci}; 3268c2ecf20Sopenharmony_ci 3278c2ecf20Sopenharmony_cistatic struct resource flash_resource = { 3288c2ecf20Sopenharmony_ci .start = 0x00000000, 3298c2ecf20Sopenharmony_ci .end = 0x2000000UL, 3308c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 3318c2ecf20Sopenharmony_ci}; 3328c2ecf20Sopenharmony_ci 3338c2ecf20Sopenharmony_cistatic struct platform_device flash_device = { 3348c2ecf20Sopenharmony_ci .name = "physmap-flash", 3358c2ecf20Sopenharmony_ci .id = -1, 3368c2ecf20Sopenharmony_ci .resource = &flash_resource, 3378c2ecf20Sopenharmony_ci .num_resources = 1, 3388c2ecf20Sopenharmony_ci .dev = { 3398c2ecf20Sopenharmony_ci .platform_data = &flash_data, 3408c2ecf20Sopenharmony_ci }, 3418c2ecf20Sopenharmony_ci}; 3428c2ecf20Sopenharmony_ci 3438c2ecf20Sopenharmony_ci/* 3448c2ecf20Sopenharmony_ci * Add all resources to the platform_device 3458c2ecf20Sopenharmony_ci */ 3468c2ecf20Sopenharmony_ci 3478c2ecf20Sopenharmony_cistatic struct platform_device *mpr2_devices[] __initdata = { 3488c2ecf20Sopenharmony_ci &heartbeat_device, 3498c2ecf20Sopenharmony_ci &smsc911x_device, 3508c2ecf20Sopenharmony_ci &flash_device, 3518c2ecf20Sopenharmony_ci}; 3528c2ecf20Sopenharmony_ci 3538c2ecf20Sopenharmony_ci 3548c2ecf20Sopenharmony_cistatic int __init mpr2_devices_setup(void) 3558c2ecf20Sopenharmony_ci{ 3568c2ecf20Sopenharmony_ci regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies)); 3578c2ecf20Sopenharmony_ci 3588c2ecf20Sopenharmony_ci return platform_add_devices(mpr2_devices, ARRAY_SIZE(mpr2_devices)); 3598c2ecf20Sopenharmony_ci} 3608c2ecf20Sopenharmony_cidevice_initcall(mpr2_devices_setup); 3618c2ecf20Sopenharmony_ci 3628c2ecf20Sopenharmony_ci/* 3638c2ecf20Sopenharmony_ci * Initialize IRQ setting 3648c2ecf20Sopenharmony_ci */ 3658c2ecf20Sopenharmony_cistatic void __init init_mpr2_IRQ(void) 3668c2ecf20Sopenharmony_ci{ 3678c2ecf20Sopenharmony_ci plat_irq_setup_pins(IRQ_MODE_IRQ); /* install handlers for IRQ0-5 */ 3688c2ecf20Sopenharmony_ci 3698c2ecf20Sopenharmony_ci irq_set_irq_type(evt2irq(0x600), IRQ_TYPE_LEVEL_LOW); /* IRQ0 CAN1 */ 3708c2ecf20Sopenharmony_ci irq_set_irq_type(evt2irq(0x620), IRQ_TYPE_LEVEL_LOW); /* IRQ1 CAN2 */ 3718c2ecf20Sopenharmony_ci irq_set_irq_type(evt2irq(0x640), IRQ_TYPE_LEVEL_LOW); /* IRQ2 CAN3 */ 3728c2ecf20Sopenharmony_ci irq_set_irq_type(evt2irq(0x660), IRQ_TYPE_LEVEL_LOW); /* IRQ3 SMSC9115 */ 3738c2ecf20Sopenharmony_ci irq_set_irq_type(evt2irq(0x680), IRQ_TYPE_EDGE_RISING); /* IRQ4 touchscreen */ 3748c2ecf20Sopenharmony_ci irq_set_irq_type(evt2irq(0x6a0), IRQ_TYPE_EDGE_FALLING); /* IRQ5 touchscreen */ 3758c2ecf20Sopenharmony_ci 3768c2ecf20Sopenharmony_ci intc_set_priority(evt2irq(0x600), 13); /* IRQ0 CAN1 */ 3778c2ecf20Sopenharmony_ci intc_set_priority(evt2irq(0x620), 13); /* IRQ0 CAN2 */ 3788c2ecf20Sopenharmony_ci intc_set_priority(evt2irq(0x640), 13); /* IRQ0 CAN3 */ 3798c2ecf20Sopenharmony_ci intc_set_priority(evt2irq(0x660), 6); /* IRQ3 SMSC9115 */ 3808c2ecf20Sopenharmony_ci} 3818c2ecf20Sopenharmony_ci 3828c2ecf20Sopenharmony_ci/* 3838c2ecf20Sopenharmony_ci * The Machine Vector 3848c2ecf20Sopenharmony_ci */ 3858c2ecf20Sopenharmony_ci 3868c2ecf20Sopenharmony_cistatic struct sh_machine_vector mv_mpr2 __initmv = { 3878c2ecf20Sopenharmony_ci .mv_name = "mpr2", 3888c2ecf20Sopenharmony_ci .mv_setup = mpr2_setup, 3898c2ecf20Sopenharmony_ci .mv_init_irq = init_mpr2_IRQ, 3908c2ecf20Sopenharmony_ci}; 391