Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2)  * arch/arm/mach-orion5x/wrt350n-v2-setup.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * This file is licensed under the terms of the GNU General Public
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * License version 2.  This program is licensed "as is" without any
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * warranty of any kind, whether express or implied.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include <linux/gpio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <linux/pci.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <linux/irq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <linux/delay.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <linux/mtd/physmap.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include <linux/mv643xx_eth.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include <linux/ethtool.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include <linux/leds.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #include <linux/gpio_keys.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #include <linux/input.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #include <linux/platform_data/dsa.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #include <asm/mach-types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #include <asm/mach/arch.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #include <asm/mach/pci.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #include "orion5x.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) #include "common.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #include "mpp.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)  * LEDs attached to GPIO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) static struct gpio_led wrt350n_v2_led_pins[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 		.name		= "wrt350nv2:green:power",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 		.gpio		= 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 		.active_low	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	}, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 		.name		= "wrt350nv2:green:security",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 		.gpio		= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 		.active_low	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	}, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 		.name		= "wrt350nv2:orange:power",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 		.gpio		= 5,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 		.active_low	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	}, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 		.name		= "wrt350nv2:green:usb",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 		.gpio		= 6,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 		.active_low	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	}, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 		.name		= "wrt350nv2:green:wireless",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 		.gpio		= 7,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 		.active_low	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) static struct gpio_led_platform_data wrt350n_v2_led_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	.leds		= wrt350n_v2_led_pins,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	.num_leds	= ARRAY_SIZE(wrt350n_v2_led_pins),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) static struct platform_device wrt350n_v2_leds = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	.name	= "leds-gpio",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	.id	= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	.dev	= {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 		.platform_data	= &wrt350n_v2_led_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70)  * Buttons attached to GPIO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) static struct gpio_keys_button wrt350n_v2_buttons[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 		.code		= KEY_RESTART,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 		.gpio		= 3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 		.desc		= "Reset Button",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 		.active_low	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	}, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 		.code		= KEY_WPS_BUTTON,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 		.gpio		= 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 		.desc		= "WPS Button",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 		.active_low	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) static struct gpio_keys_platform_data wrt350n_v2_button_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	.buttons	= wrt350n_v2_buttons,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	.nbuttons	= ARRAY_SIZE(wrt350n_v2_buttons),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) static struct platform_device wrt350n_v2_button_device = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	.name		= "gpio-keys",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	.id		= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	.num_resources	= 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	.dev		= {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 		.platform_data	= &wrt350n_v2_button_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)  * General setup
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) static unsigned int wrt350n_v2_mpp_modes[] __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	MPP0_GPIO,		/* Power LED green (0=on) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	MPP1_GPIO,		/* Security LED (0=on) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	MPP2_GPIO,		/* Internal Button (0=on) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	MPP3_GPIO,		/* Reset Button (0=on) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	MPP4_GPIO,		/* PCI int */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	MPP5_GPIO,		/* Power LED orange (0=on) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	MPP6_GPIO,		/* USB LED (0=on) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	MPP7_GPIO,		/* Wireless LED (0=on) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	MPP8_UNUSED,		/* ??? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	MPP9_GIGE,		/* GE_RXERR */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	MPP10_UNUSED,		/* ??? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	MPP11_UNUSED,		/* ??? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	MPP12_GIGE,		/* GE_TXD[4] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	MPP13_GIGE,		/* GE_TXD[5] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	MPP14_GIGE,		/* GE_TXD[6] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	MPP15_GIGE,		/* GE_TXD[7] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	MPP16_GIGE,		/* GE_RXD[4] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	MPP17_GIGE,		/* GE_RXD[5] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	MPP18_GIGE,		/* GE_RXD[6] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	MPP19_GIGE,		/* GE_RXD[7] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128)  * 8M NOR flash Device bus boot chip select
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) #define WRT350N_V2_NOR_BOOT_BASE	0xf4000000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) #define WRT350N_V2_NOR_BOOT_SIZE	SZ_8M
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) static struct mtd_partition wrt350n_v2_nor_flash_partitions[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 		.name		= "kernel",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 		.offset		= 0x00000000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 		.size		= 0x00760000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	}, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 		.name		= "rootfs",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 		.offset		= 0x001a0000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 		.size		= 0x005c0000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	}, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 		.name		= "lang",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 		.offset		= 0x00760000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 		.size		= 0x00040000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	}, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 		.name		= "nvram",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 		.offset		= 0x007a0000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 		.size		= 0x00020000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	}, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 		.name		= "u-boot",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 		.offset		= 0x007c0000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 		.size		= 0x00040000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) static struct physmap_flash_data wrt350n_v2_nor_flash_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	.width		= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	.parts		= wrt350n_v2_nor_flash_partitions,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	.nr_parts	= ARRAY_SIZE(wrt350n_v2_nor_flash_partitions),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) static struct resource wrt350n_v2_nor_flash_resource = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	.flags		= IORESOURCE_MEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	.start		= WRT350N_V2_NOR_BOOT_BASE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	.end		= WRT350N_V2_NOR_BOOT_BASE + WRT350N_V2_NOR_BOOT_SIZE - 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) static struct platform_device wrt350n_v2_nor_flash = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	.name			= "physmap-flash",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	.id			= 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	.dev		= {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 		.platform_data	= &wrt350n_v2_nor_flash_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	.num_resources		= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	.resource		= &wrt350n_v2_nor_flash_resource,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) static struct mv643xx_eth_platform_data wrt350n_v2_eth_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	.phy_addr	= MV643XX_ETH_PHY_NONE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 	.speed		= SPEED_1000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	.duplex		= DUPLEX_FULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) static struct dsa_chip_data wrt350n_v2_switch_chip_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	.port_names[0]	= "lan2",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	.port_names[1]	= "lan1",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	.port_names[2]	= "wan",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 	.port_names[3]	= "cpu",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	.port_names[5]	= "lan3",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	.port_names[7]	= "lan4",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) static void __init wrt350n_v2_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	 * Setup basic Orion functions. Need to be called early.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	orion5x_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	orion5x_mpp_conf(wrt350n_v2_mpp_modes);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	 * Configure peripherals.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 	orion5x_ehci0_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	orion5x_eth_init(&wrt350n_v2_eth_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 	orion5x_eth_switch_init(&wrt350n_v2_switch_chip_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	orion5x_uart0_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 	mvebu_mbus_add_window_by_id(ORION_MBUS_DEVBUS_BOOT_TARGET,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 				    ORION_MBUS_DEVBUS_BOOT_ATTR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 				    WRT350N_V2_NOR_BOOT_BASE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 				    WRT350N_V2_NOR_BOOT_SIZE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	platform_device_register(&wrt350n_v2_nor_flash);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	platform_device_register(&wrt350n_v2_leds);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	platform_device_register(&wrt350n_v2_button_device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) static int __init wrt350n_v2_pci_map_irq(const struct pci_dev *dev, u8 slot,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 	u8 pin)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 	int irq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 	 * Check for devices with hard-wired IRQs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 	irq = orion5x_pci_map_irq(dev, slot, pin);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	if (irq != -1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 		return irq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 	 * Mini-PCI slot.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 	if (slot == 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 		return gpio_to_irq(4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 	return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) static struct hw_pci wrt350n_v2_pci __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 	.nr_controllers	= 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 	.setup		= orion5x_pci_sys_setup,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 	.scan		= orion5x_pci_sys_scan_bus,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 	.map_irq	= wrt350n_v2_pci_map_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) static int __init wrt350n_v2_pci_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 	if (machine_is_wrt350n_v2())
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 		pci_common_init(&wrt350n_v2_pci);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) subsys_initcall(wrt350n_v2_pci_init);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) MACHINE_START(WRT350N_V2, "Linksys WRT350N v2")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 	/* Maintainer: Lennert Buytenhek <buytenh@marvell.com> */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 	.atag_offset	= 0x100,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 	.nr_irqs	= ORION5X_NR_IRQS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 	.init_machine	= wrt350n_v2_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 	.map_io		= orion5x_map_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 	.init_early	= orion5x_init_early,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 	.init_irq	= orion5x_init_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 	.init_time	= orion5x_timer_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 	.fixup		= tag_fixup_mem32,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 	.restart	= orion5x_restart,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) MACHINE_END