^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) * arch/arm/plat-orion/common.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Marvell Orion SoC common setup code used by multiple mach-/common.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * This file is licensed under the terms of the GNU General Public
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * License version 2. This program is licensed "as is" without any
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * warranty of any kind, whether express or implied.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/dma-mapping.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/serial_8250.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/ata_platform.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <linux/clk.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <linux/clkdev.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <linux/mv643xx_eth.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <linux/mv643xx_i2c.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 <linux/platform_data/dma-mv_xor.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #include <linux/platform_data/usb-ehci-orion.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #include <plat/common.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #include <linux/phy.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) /* Create a clkdev entry for a given device/clk */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) void __init orion_clkdev_add(const char *con_id, const char *dev_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) struct clk *clk)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) clkdev_create(clk, con_id, "%s", dev_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) /* Create clkdev entries for all orion platforms except kirkwood.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) Kirkwood has gated clocks for some of its peripherals, so creates
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) its own clkdev entries. For all the other orion devices, create
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) clkdev entries to the tclk. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) void __init orion_clkdev_init(struct clk *tclk)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) orion_clkdev_add(NULL, "orion_spi.0", tclk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) orion_clkdev_add(NULL, "orion_spi.1", tclk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) orion_clkdev_add(NULL, MV643XX_ETH_NAME ".0", tclk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) orion_clkdev_add(NULL, MV643XX_ETH_NAME ".1", tclk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) orion_clkdev_add(NULL, MV643XX_ETH_NAME ".2", tclk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) orion_clkdev_add(NULL, MV643XX_ETH_NAME ".3", tclk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) orion_clkdev_add(NULL, "orion_wdt", tclk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) orion_clkdev_add(NULL, MV64XXX_I2C_CTLR_NAME ".0", tclk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) /* Fill in the resources structure and link it into the platform
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) device structure. There is always a memory region, and nearly
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) always an interrupt.*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) static void fill_resources(struct platform_device *device,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) struct resource *resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) resource_size_t mapbase,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) resource_size_t size)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) device->resource = resources;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) device->num_resources = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) resources[0].flags = IORESOURCE_MEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) resources[0].start = mapbase;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) resources[0].end = mapbase + size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) static void fill_resources_irq(struct platform_device *device,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) struct resource *resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) resource_size_t mapbase,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) resource_size_t size,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) unsigned int irq)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) fill_resources(device, resources, mapbase, size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) device->num_resources++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) resources[1].flags = IORESOURCE_IRQ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) resources[1].start = irq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) resources[1].end = irq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) /*****************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) * UART
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) ****************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) static unsigned long __init uart_get_clk_rate(struct clk *clk)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) clk_prepare_enable(clk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) return clk_get_rate(clk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) static void __init uart_complete(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) struct platform_device *orion_uart,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) struct plat_serial8250_port *data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) struct resource *resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) void __iomem *membase,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) resource_size_t mapbase,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) unsigned int irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) struct clk *clk)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) data->mapbase = mapbase;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) data->membase = membase;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) data->irq = irq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) data->uartclk = uart_get_clk_rate(clk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) orion_uart->dev.platform_data = data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) fill_resources_irq(orion_uart, resources, mapbase, 0xff, irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) platform_device_register(orion_uart);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) /*****************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) * UART0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) ****************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) static struct plat_serial8250_port orion_uart0_data[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) .iotype = UPIO_MEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) .regshift = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) static struct resource orion_uart0_resources[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) static struct platform_device orion_uart0 = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) .name = "serial8250",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) .id = PLAT8250_DEV_PLATFORM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) void __init orion_uart0_init(void __iomem *membase,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) resource_size_t mapbase,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) unsigned int irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) struct clk *clk)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) uart_complete(&orion_uart0, orion_uart0_data, orion_uart0_resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) membase, mapbase, irq, clk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) /*****************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) * UART1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) ****************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) static struct plat_serial8250_port orion_uart1_data[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) .iotype = UPIO_MEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) .regshift = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) static struct resource orion_uart1_resources[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) static struct platform_device orion_uart1 = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) .name = "serial8250",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) .id = PLAT8250_DEV_PLATFORM1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) void __init orion_uart1_init(void __iomem *membase,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) resource_size_t mapbase,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) unsigned int irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) struct clk *clk)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) uart_complete(&orion_uart1, orion_uart1_data, orion_uart1_resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) membase, mapbase, irq, clk);
^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) /*****************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) * UART2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) ****************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) static struct plat_serial8250_port orion_uart2_data[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) .iotype = UPIO_MEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) .regshift = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) static struct resource orion_uart2_resources[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) static struct platform_device orion_uart2 = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) .name = "serial8250",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) .id = PLAT8250_DEV_PLATFORM2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) void __init orion_uart2_init(void __iomem *membase,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) resource_size_t mapbase,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) unsigned int irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) struct clk *clk)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) uart_complete(&orion_uart2, orion_uart2_data, orion_uart2_resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) membase, mapbase, irq, clk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) /*****************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) * UART3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) ****************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) static struct plat_serial8250_port orion_uart3_data[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) .iotype = UPIO_MEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) .regshift = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) static struct resource orion_uart3_resources[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) static struct platform_device orion_uart3 = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) .name = "serial8250",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) .id = 3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) void __init orion_uart3_init(void __iomem *membase,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) resource_size_t mapbase,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) unsigned int irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) struct clk *clk)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) uart_complete(&orion_uart3, orion_uart3_data, orion_uart3_resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) membase, mapbase, irq, clk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) }
^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) * SoC RTC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) ****************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) static struct resource orion_rtc_resource[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) void __init orion_rtc_init(unsigned long mapbase,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) unsigned long irq)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) orion_rtc_resource[0].start = mapbase;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) orion_rtc_resource[0].end = mapbase + SZ_32 - 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) orion_rtc_resource[0].flags = IORESOURCE_MEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) orion_rtc_resource[1].start = irq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) orion_rtc_resource[1].end = irq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) orion_rtc_resource[1].flags = IORESOURCE_IRQ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) platform_device_register_simple("rtc-mv", -1, orion_rtc_resource, 2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) /*****************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) * GE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) ****************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) static __init void ge_complete(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) struct mv643xx_eth_shared_platform_data *orion_ge_shared_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) struct resource *orion_ge_resource, unsigned long irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) struct platform_device *orion_ge_shared,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) struct platform_device *orion_ge_mvmdio,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) struct mv643xx_eth_platform_data *eth_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) struct platform_device *orion_ge)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) orion_ge_resource->start = irq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) orion_ge_resource->end = irq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) eth_data->shared = orion_ge_shared;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) orion_ge->dev.platform_data = eth_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) platform_device_register(orion_ge_shared);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) if (orion_ge_mvmdio)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) platform_device_register(orion_ge_mvmdio);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) platform_device_register(orion_ge);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) /*****************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) * GE00
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) ****************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) static struct mv643xx_eth_shared_platform_data orion_ge00_shared_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) static struct resource orion_ge00_shared_resources[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) .name = "ge00 base",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) static struct platform_device orion_ge00_shared = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) .name = MV643XX_ETH_SHARED_NAME,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) .id = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) .platform_data = &orion_ge00_shared_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) static struct resource orion_ge_mvmdio_resources[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) .name = "ge00 mvmdio base",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) .name = "ge00 mvmdio err irq",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) static struct platform_device orion_ge_mvmdio = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) .name = "orion-mdio",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) .id = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) static struct resource orion_ge00_resources[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) .name = "ge00 irq",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) .flags = IORESOURCE_IRQ,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) static struct platform_device orion_ge00 = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) .name = MV643XX_ETH_NAME,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) .id = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) .num_resources = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) .resource = orion_ge00_resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) .coherent_dma_mask = DMA_BIT_MASK(32),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) void __init orion_ge00_init(struct mv643xx_eth_platform_data *eth_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) unsigned long mapbase,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) unsigned long irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) unsigned long irq_err,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) unsigned int tx_csum_limit)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) fill_resources(&orion_ge00_shared, orion_ge00_shared_resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) mapbase + 0x2000, SZ_16K - 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) fill_resources_irq(&orion_ge_mvmdio, orion_ge_mvmdio_resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) mapbase + 0x2004, 0x84 - 1, irq_err);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) orion_ge00_shared_data.tx_csum_limit = tx_csum_limit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) ge_complete(&orion_ge00_shared_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) orion_ge00_resources, irq, &orion_ge00_shared,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) &orion_ge_mvmdio,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) eth_data, &orion_ge00);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) /*****************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) * GE01
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) ****************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) static struct mv643xx_eth_shared_platform_data orion_ge01_shared_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) static struct resource orion_ge01_shared_resources[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) .name = "ge01 base",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) static struct platform_device orion_ge01_shared = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) .name = MV643XX_ETH_SHARED_NAME,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) .id = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) .platform_data = &orion_ge01_shared_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) static struct resource orion_ge01_resources[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) .name = "ge01 irq",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) .flags = IORESOURCE_IRQ,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) static struct platform_device orion_ge01 = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) .name = MV643XX_ETH_NAME,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) .id = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) .num_resources = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) .resource = orion_ge01_resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) .coherent_dma_mask = DMA_BIT_MASK(32),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) void __init orion_ge01_init(struct mv643xx_eth_platform_data *eth_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) unsigned long mapbase,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) unsigned long irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) unsigned int tx_csum_limit)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) fill_resources(&orion_ge01_shared, orion_ge01_shared_resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) mapbase + 0x2000, SZ_16K - 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) orion_ge01_shared_data.tx_csum_limit = tx_csum_limit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) ge_complete(&orion_ge01_shared_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) orion_ge01_resources, irq, &orion_ge01_shared,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) eth_data, &orion_ge01);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) /*****************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) * GE10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) ****************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) static struct mv643xx_eth_shared_platform_data orion_ge10_shared_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) static struct resource orion_ge10_shared_resources[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) .name = "ge10 base",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) static struct platform_device orion_ge10_shared = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) .name = MV643XX_ETH_SHARED_NAME,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) .id = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) .platform_data = &orion_ge10_shared_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) static struct resource orion_ge10_resources[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) .name = "ge10 irq",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) .flags = IORESOURCE_IRQ,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) static struct platform_device orion_ge10 = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) .name = MV643XX_ETH_NAME,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) .id = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) .num_resources = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) .resource = orion_ge10_resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) .coherent_dma_mask = DMA_BIT_MASK(32),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) void __init orion_ge10_init(struct mv643xx_eth_platform_data *eth_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) unsigned long mapbase,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) unsigned long irq)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) fill_resources(&orion_ge10_shared, orion_ge10_shared_resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) mapbase + 0x2000, SZ_16K - 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) ge_complete(&orion_ge10_shared_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) orion_ge10_resources, irq, &orion_ge10_shared,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) eth_data, &orion_ge10);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) /*****************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) * GE11
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) ****************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) static struct mv643xx_eth_shared_platform_data orion_ge11_shared_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) static struct resource orion_ge11_shared_resources[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) .name = "ge11 base",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) static struct platform_device orion_ge11_shared = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) .name = MV643XX_ETH_SHARED_NAME,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) .id = 3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) .platform_data = &orion_ge11_shared_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) static struct resource orion_ge11_resources[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) .name = "ge11 irq",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) .flags = IORESOURCE_IRQ,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) static struct platform_device orion_ge11 = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) .name = MV643XX_ETH_NAME,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) .id = 3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) .num_resources = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) .resource = orion_ge11_resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) .coherent_dma_mask = DMA_BIT_MASK(32),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) void __init orion_ge11_init(struct mv643xx_eth_platform_data *eth_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) unsigned long mapbase,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) unsigned long irq)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) fill_resources(&orion_ge11_shared, orion_ge11_shared_resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) mapbase + 0x2000, SZ_16K - 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) ge_complete(&orion_ge11_shared_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) orion_ge11_resources, irq, &orion_ge11_shared,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) eth_data, &orion_ge11);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) #ifdef CONFIG_ARCH_ORION5X
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) /*****************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) * Ethernet switch
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) ****************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) static __initdata struct mdio_board_info orion_ge00_switch_board_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) .bus_id = "orion-mii",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) .modalias = "mv88e6085",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) void __init orion_ge00_switch_init(struct dsa_chip_data *d)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) unsigned int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) if (!IS_BUILTIN(CONFIG_PHYLIB))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) for (i = 0; i < ARRAY_SIZE(d->port_names); i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) if (!strcmp(d->port_names[i], "cpu")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) d->netdev[i] = &orion_ge00.dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) orion_ge00_switch_board_info.mdio_addr = d->sw_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) orion_ge00_switch_board_info.platform_data = d;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) mdiobus_register_board_info(&orion_ge00_switch_board_info, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) /*****************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) * I2C
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) ****************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) static struct mv64xxx_i2c_pdata orion_i2c_pdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) .freq_n = 3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) .timeout = 1000, /* Default timeout of 1 second */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) static struct resource orion_i2c_resources[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) static struct platform_device orion_i2c = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) .name = MV64XXX_I2C_CTLR_NAME,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) .id = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) .platform_data = &orion_i2c_pdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) static struct mv64xxx_i2c_pdata orion_i2c_1_pdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) .freq_n = 3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) .timeout = 1000, /* Default timeout of 1 second */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) static struct resource orion_i2c_1_resources[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) static struct platform_device orion_i2c_1 = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) .name = MV64XXX_I2C_CTLR_NAME,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) .id = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) .platform_data = &orion_i2c_1_pdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) void __init orion_i2c_init(unsigned long mapbase,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) unsigned long irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) unsigned long freq_m)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) orion_i2c_pdata.freq_m = freq_m;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) fill_resources_irq(&orion_i2c, orion_i2c_resources, mapbase,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) SZ_32 - 1, irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) platform_device_register(&orion_i2c);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) void __init orion_i2c_1_init(unsigned long mapbase,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545) unsigned long irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) unsigned long freq_m)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) orion_i2c_1_pdata.freq_m = freq_m;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549) fill_resources_irq(&orion_i2c_1, orion_i2c_1_resources, mapbase,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) SZ_32 - 1, irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) platform_device_register(&orion_i2c_1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) /*****************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) * SPI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) ****************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) static struct resource orion_spi_resources;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) static struct platform_device orion_spi = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) .name = "orion_spi",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) .id = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) static struct resource orion_spi_1_resources;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) static struct platform_device orion_spi_1 = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) .name = "orion_spi",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) .id = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) /* Note: The SPI silicon core does have interrupts. However the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) * current Linux software driver does not use interrupts. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) void __init orion_spi_init(unsigned long mapbase)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) fill_resources(&orion_spi, &orion_spi_resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577) mapbase, SZ_512 - 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578) platform_device_register(&orion_spi);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) void __init orion_spi_1_init(unsigned long mapbase)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) fill_resources(&orion_spi_1, &orion_spi_1_resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) mapbase, SZ_512 - 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) platform_device_register(&orion_spi_1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) /*****************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) * XOR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) ****************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) static u64 orion_xor_dmamask = DMA_BIT_MASK(32);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) /*****************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) * XOR0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) ****************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) static struct resource orion_xor0_shared_resources[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) .name = "xor 0 low",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) .flags = IORESOURCE_MEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) .name = "xor 0 high",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) .flags = IORESOURCE_MEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604) .name = "irq channel 0",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) .flags = IORESOURCE_IRQ,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607) .name = "irq channel 1",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608) .flags = IORESOURCE_IRQ,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612) static struct mv_xor_channel_data orion_xor0_channels_data[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) static struct mv_xor_platform_data orion_xor0_pdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615) .channels = orion_xor0_channels_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618) static struct platform_device orion_xor0_shared = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619) .name = MV_XOR_NAME,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620) .id = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621) .num_resources = ARRAY_SIZE(orion_xor0_shared_resources),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622) .resource = orion_xor0_shared_resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) .dma_mask = &orion_xor_dmamask,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625) .coherent_dma_mask = DMA_BIT_MASK(32),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626) .platform_data = &orion_xor0_pdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630) void __init orion_xor0_init(unsigned long mapbase_low,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631) unsigned long mapbase_high,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632) unsigned long irq_0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633) unsigned long irq_1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635) orion_xor0_shared_resources[0].start = mapbase_low;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636) orion_xor0_shared_resources[0].end = mapbase_low + 0xff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637) orion_xor0_shared_resources[1].start = mapbase_high;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638) orion_xor0_shared_resources[1].end = mapbase_high + 0xff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640) orion_xor0_shared_resources[2].start = irq_0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641) orion_xor0_shared_resources[2].end = irq_0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642) orion_xor0_shared_resources[3].start = irq_1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643) orion_xor0_shared_resources[3].end = irq_1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 644)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 645) dma_cap_set(DMA_MEMCPY, orion_xor0_channels_data[0].cap_mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 646) dma_cap_set(DMA_XOR, orion_xor0_channels_data[0].cap_mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 647)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 648) dma_cap_set(DMA_MEMCPY, orion_xor0_channels_data[1].cap_mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 649) dma_cap_set(DMA_XOR, orion_xor0_channels_data[1].cap_mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 650)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 651) platform_device_register(&orion_xor0_shared);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 652) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 653)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 654) /*****************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 655) * XOR1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 656) ****************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 657) static struct resource orion_xor1_shared_resources[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 658) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 659) .name = "xor 1 low",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 660) .flags = IORESOURCE_MEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 661) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 662) .name = "xor 1 high",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 663) .flags = IORESOURCE_MEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 664) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 665) .name = "irq channel 0",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 666) .flags = IORESOURCE_IRQ,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 667) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 668) .name = "irq channel 1",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 669) .flags = IORESOURCE_IRQ,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 670) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 671) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 672)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 673) static struct mv_xor_channel_data orion_xor1_channels_data[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 674)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 675) static struct mv_xor_platform_data orion_xor1_pdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 676) .channels = orion_xor1_channels_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 677) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 678)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 679) static struct platform_device orion_xor1_shared = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 680) .name = MV_XOR_NAME,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 681) .id = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 682) .num_resources = ARRAY_SIZE(orion_xor1_shared_resources),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 683) .resource = orion_xor1_shared_resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 684) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 685) .dma_mask = &orion_xor_dmamask,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 686) .coherent_dma_mask = DMA_BIT_MASK(32),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 687) .platform_data = &orion_xor1_pdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 688) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 689) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 690)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 691) void __init orion_xor1_init(unsigned long mapbase_low,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 692) unsigned long mapbase_high,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 693) unsigned long irq_0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 694) unsigned long irq_1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 695) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 696) orion_xor1_shared_resources[0].start = mapbase_low;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 697) orion_xor1_shared_resources[0].end = mapbase_low + 0xff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 698) orion_xor1_shared_resources[1].start = mapbase_high;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 699) orion_xor1_shared_resources[1].end = mapbase_high + 0xff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 700)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 701) orion_xor1_shared_resources[2].start = irq_0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 702) orion_xor1_shared_resources[2].end = irq_0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 703) orion_xor1_shared_resources[3].start = irq_1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 704) orion_xor1_shared_resources[3].end = irq_1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 705)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 706) dma_cap_set(DMA_MEMCPY, orion_xor1_channels_data[0].cap_mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 707) dma_cap_set(DMA_XOR, orion_xor1_channels_data[0].cap_mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 708)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 709) dma_cap_set(DMA_MEMCPY, orion_xor1_channels_data[1].cap_mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 710) dma_cap_set(DMA_XOR, orion_xor1_channels_data[1].cap_mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 711)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 712) platform_device_register(&orion_xor1_shared);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 713) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 714)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 715) /*****************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 716) * EHCI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 717) ****************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 718) static struct orion_ehci_data orion_ehci_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 719) static u64 ehci_dmamask = DMA_BIT_MASK(32);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 720)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 721)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 722) /*****************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 723) * EHCI0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 724) ****************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 725) static struct resource orion_ehci_resources[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 726)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 727) static struct platform_device orion_ehci = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 728) .name = "orion-ehci",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 729) .id = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 730) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 731) .dma_mask = &ehci_dmamask,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 732) .coherent_dma_mask = DMA_BIT_MASK(32),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 733) .platform_data = &orion_ehci_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 734) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 735) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 736)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 737) void __init orion_ehci_init(unsigned long mapbase,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 738) unsigned long irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 739) enum orion_ehci_phy_ver phy_version)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 740) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 741) orion_ehci_data.phy_version = phy_version;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 742) fill_resources_irq(&orion_ehci, orion_ehci_resources, mapbase, SZ_4K - 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 743) irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 744)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 745) platform_device_register(&orion_ehci);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 746) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 747)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 748) /*****************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 749) * EHCI1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 750) ****************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 751) static struct resource orion_ehci_1_resources[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 752)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 753) static struct platform_device orion_ehci_1 = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 754) .name = "orion-ehci",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 755) .id = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 756) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 757) .dma_mask = &ehci_dmamask,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 758) .coherent_dma_mask = DMA_BIT_MASK(32),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 759) .platform_data = &orion_ehci_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 760) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 761) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 762)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 763) void __init orion_ehci_1_init(unsigned long mapbase,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 764) unsigned long irq)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 765) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 766) fill_resources_irq(&orion_ehci_1, orion_ehci_1_resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 767) mapbase, SZ_4K - 1, irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 768)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 769) platform_device_register(&orion_ehci_1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 770) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 771)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 772) /*****************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 773) * EHCI2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 774) ****************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 775) static struct resource orion_ehci_2_resources[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 776)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 777) static struct platform_device orion_ehci_2 = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 778) .name = "orion-ehci",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 779) .id = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 780) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 781) .dma_mask = &ehci_dmamask,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 782) .coherent_dma_mask = DMA_BIT_MASK(32),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 783) .platform_data = &orion_ehci_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 784) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 785) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 786)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 787) void __init orion_ehci_2_init(unsigned long mapbase,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 788) unsigned long irq)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 789) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 790) fill_resources_irq(&orion_ehci_2, orion_ehci_2_resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 791) mapbase, SZ_4K - 1, irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 792)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 793) platform_device_register(&orion_ehci_2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 794) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 795)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 796) /*****************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 797) * SATA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 798) ****************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 799) static struct resource orion_sata_resources[2] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 800) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 801) .name = "sata base",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 802) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 803) .name = "sata irq",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 804) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 805) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 806)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 807) static struct platform_device orion_sata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 808) .name = "sata_mv",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 809) .id = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 810) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 811) .coherent_dma_mask = DMA_BIT_MASK(32),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 812) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 813) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 814)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 815) void __init orion_sata_init(struct mv_sata_platform_data *sata_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 816) unsigned long mapbase,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 817) unsigned long irq)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 818) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 819) orion_sata.dev.platform_data = sata_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 820) fill_resources_irq(&orion_sata, orion_sata_resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 821) mapbase, 0x5000 - 1, irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 822)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 823) platform_device_register(&orion_sata);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 824) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 825)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 826) /*****************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 827) * Cryptographic Engines and Security Accelerator (CESA)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 828) ****************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 829) static struct resource orion_crypto_resources[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 830) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 831) .name = "regs",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 832) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 833) .name = "crypto interrupt",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 834) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 835) .name = "sram",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 836) .flags = IORESOURCE_MEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 837) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 838) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 839)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 840) static struct platform_device orion_crypto = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 841) .name = "mv_crypto",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 842) .id = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 843) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 844)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 845) void __init orion_crypto_init(unsigned long mapbase,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 846) unsigned long srambase,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 847) unsigned long sram_size,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 848) unsigned long irq)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 849) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 850) fill_resources_irq(&orion_crypto, orion_crypto_resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 851) mapbase, 0xffff, irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 852) orion_crypto.num_resources = 3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 853) orion_crypto_resources[2].start = srambase;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 854) orion_crypto_resources[2].end = srambase + sram_size - 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 855)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 856) platform_device_register(&orion_crypto);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 857) }