Merge branch '83xx' into for_paulus

This commit is contained in:
Kumar Gala 2007-02-09 11:40:48 -06:00
Родитель 8f34f6cfa2 49baa91d68
Коммит b8583f6872
13 изменённых файлов: 1923 добавлений и 66 удалений

Просмотреть файл

@ -1334,6 +1334,9 @@ platforms are moved over to use the flattened-device-tree model.
fsl-usb2-mph compatible controllers. Either this property or fsl-usb2-mph compatible controllers. Either this property or
"port0" (or both) must be defined for "fsl-usb2-mph" compatible "port0" (or both) must be defined for "fsl-usb2-mph" compatible
controllers. controllers.
- dr_mode : indicates the working mode for "fsl-usb2-dr" compatible
controllers. Can be "host", "peripheral", or "otg". Default to
"host" if not defined for backward compatibility.
Recommended properties : Recommended properties :
- interrupts : <a b> where a is the interrupt number and b is a - interrupts : <a b> where a is the interrupt number and b is a
@ -1367,6 +1370,7 @@ platforms are moved over to use the flattened-device-tree model.
#size-cells = <0>; #size-cells = <0>;
interrupt-parent = <700>; interrupt-parent = <700>;
interrupts = <26 1>; interrupts = <26 1>;
dr_mode = "otg";
phy = "ulpi"; phy = "ulpi";
}; };

Просмотреть файл

@ -0,0 +1,219 @@
/*
* MPC8313E RDB Device Tree Source
*
* Copyright 2005, 2006, 2007 Freescale Semiconductor Inc.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*/
/ {
model = "MPC8313ERDB";
compatible = "MPC83xx";
#address-cells = <1>;
#size-cells = <1>;
cpus {
#cpus = <1>;
#address-cells = <1>;
#size-cells = <0>;
PowerPC,8313@0 {
device_type = "cpu";
reg = <0>;
d-cache-line-size = <20>; // 32 bytes
i-cache-line-size = <20>; // 32 bytes
d-cache-size = <4000>; // L1, 16K
i-cache-size = <4000>; // L1, 16K
timebase-frequency = <0>; // from bootloader
bus-frequency = <0>; // from bootloader
clock-frequency = <0>; // from bootloader
32-bit;
};
};
memory {
device_type = "memory";
reg = <00000000 08000000>; // 128MB at 0
};
soc8313@e0000000 {
#address-cells = <1>;
#size-cells = <1>;
#interrupt-cells = <2>;
device_type = "soc";
ranges = <0 e0000000 00100000>;
reg = <e0000000 00000200>;
bus-frequency = <0>;
wdt@200 {
device_type = "watchdog";
compatible = "mpc83xx_wdt";
reg = <200 100>;
};
i2c@3000 {
device_type = "i2c";
compatible = "fsl-i2c";
reg = <3000 100>;
interrupts = <e 8>;
interrupt-parent = <700>;
dfsrr;
};
i2c@3100 {
device_type = "i2c";
compatible = "fsl-i2c";
reg = <3100 100>;
interrupts = <f 8>;
interrupt-parent = <700>;
dfsrr;
};
spi@7000 {
device_type = "spi";
compatible = "mpc83xx_spi";
reg = <7000 1000>;
interrupts = <10 8>;
interrupt-parent = <700>;
mode = <0>;
};
/* phy type (ULPI, UTMI, UTMI_WIDE, SERIAL) */
usb@23000 {
device_type = "usb";
compatible = "fsl-usb2-dr";
reg = <23000 1000>;
#address-cells = <1>;
#size-cells = <0>;
interrupt-parent = <700>;
interrupts = <26 2>;
phy_type = "utmi_wide";
};
mdio@24520 {
device_type = "mdio";
compatible = "gianfar";
reg = <24520 20>;
#address-cells = <1>;
#size-cells = <0>;
linux,phandle = <24520>;
ethernet-phy@1 {
linux,phandle = <2452001>;
interrupt-parent = <700>;
interrupts = <13 2>;
reg = <1>;
device_type = "ethernet-phy";
};
ethernet-phy@4 {
linux,phandle = <2452004>;
interrupt-parent = <700>;
interrupts = <14 2>;
reg = <4>;
device_type = "ethernet-phy";
};
};
ethernet@24000 {
device_type = "network";
model = "eTSEC";
compatible = "gianfar";
reg = <24000 1000>;
local-mac-address = [ 00 00 00 00 00 00 ];
interrupts = <25 8 24 8 23 8>;
interrupt-parent = <700>;
phy-handle = <2452001>;
};
ethernet@25000 {
device_type = "network";
model = "eTSEC";
compatible = "gianfar";
reg = <25000 1000>;
local-mac-address = [ 00 00 00 00 00 00 ];
interrupts = <22 8 21 8 20 8>;
interrupt-parent = <700>;
phy-handle = <2452004>;
};
serial@4500 {
device_type = "serial";
compatible = "ns16550";
reg = <4500 100>;
clock-frequency = <0>;
interrupts = <9 8>;
interrupt-parent = <700>;
};
serial@4600 {
device_type = "serial";
compatible = "ns16550";
reg = <4600 100>;
clock-frequency = <0>;
interrupts = <a 8>;
interrupt-parent = <700>;
};
pci@8500 {
interrupt-map-mask = <f800 0 0 7>;
interrupt-map = <
/* IDSEL 0x0E -mini PCI */
7000 0 0 1 700 12 8
7000 0 0 2 700 12 8
7000 0 0 3 700 12 8
7000 0 0 4 700 12 8
/* IDSEL 0x0F - PCI slot */
7800 0 0 1 700 11 8
7800 0 0 2 700 12 8
7800 0 0 3 700 11 8
7800 0 0 4 700 12 8>;
interrupt-parent = <700>;
interrupts = <42 8>;
bus-range = <0 0>;
ranges = <02000000 0 90000000 90000000 0 10000000
42000000 0 80000000 80000000 0 10000000
01000000 0 00000000 e2000000 0 00100000>;
clock-frequency = <3f940aa>;
#interrupt-cells = <1>;
#size-cells = <2>;
#address-cells = <3>;
reg = <8500 100>;
compatible = "83xx";
device_type = "pci";
};
crypto@30000 {
device_type = "crypto";
model = "SEC2";
compatible = "talitos";
reg = <30000 7000>;
interrupts = <b 8>;
interrupt-parent = <700>;
/* Rev. 2.2 */
num-channels = <1>;
channel-fifo-len = <18>;
exec-units-mask = <0000004c>;
descriptor-types-mask = <0122003f>;
};
/* IPIC
* interrupts cell = <intr #, sense>
* sense values match linux IORESOURCE_IRQ_* defines:
* sense == 8: Level, low assertion
* sense == 2: Edge, high-to-low change
*/
pic@700 {
linux,phandle = <700>;
interrupt-controller;
#address-cells = <0>;
#interrupt-cells = <2>;
reg = <700 100>;
built-in;
device_type = "ipic";
};
};
};

Просмотреть файл

@ -39,6 +39,11 @@
reg = <00000000 10000000>; // 256MB at 0 reg = <00000000 10000000>; // 256MB at 0
}; };
bcsr@e2400000 {
device_type = "board-control";
reg = <e2400000 8000>;
};
soc8349@e0000000 { soc8349@e0000000 {
#address-cells = <1>; #address-cells = <1>;
#size-cells = <1>; #size-cells = <1>;
@ -103,6 +108,7 @@
#size-cells = <0>; #size-cells = <0>;
interrupt-parent = <700>; interrupt-parent = <700>;
interrupts = <26 2>; interrupts = <26 2>;
dr_mode = "otg";
phy_type = "ulpi"; phy_type = "ulpi";
}; };

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,7 +1,7 @@
# #
# Automatically generated make config: don't edit # Automatically generated make config: don't edit
# Linux kernel version: 2.6.20-rc5 # Linux kernel version: 2.6.20
# Fri Jan 26 00:19:27 2007 # Thu Feb 8 01:00:48 2007
# #
# CONFIG_PPC64 is not set # CONFIG_PPC64 is not set
CONFIG_PPC32=y CONFIG_PPC32=y
@ -34,9 +34,9 @@ CONFIG_DEFAULT_UIMAGE=y
CONFIG_PPC_83xx=y CONFIG_PPC_83xx=y
# CONFIG_PPC_85xx is not set # CONFIG_PPC_85xx is not set
# CONFIG_PPC_86xx is not set # CONFIG_PPC_86xx is not set
# CONFIG_PPC_8xx is not set
# CONFIG_40x is not set # CONFIG_40x is not set
# CONFIG_44x is not set # CONFIG_44x is not set
# CONFIG_8xx is not set
# CONFIG_E200 is not set # CONFIG_E200 is not set
CONFIG_6xx=y CONFIG_6xx=y
CONFIG_83xx=y CONFIG_83xx=y
@ -128,8 +128,9 @@ CONFIG_PPC_GEN550=y
# #
# Platform support # Platform support
# #
# CONFIG_MPC8313_RDB is not set
# CONFIG_MPC832x_MDS is not set # CONFIG_MPC832x_MDS is not set
CONFIG_MPC834x_SYS=y CONFIG_MPC834x_MDS=y
# CONFIG_MPC834x_ITX is not set # CONFIG_MPC834x_ITX is not set
# CONFIG_MPC8360E_PB is not set # CONFIG_MPC8360E_PB is not set
CONFIG_MPC834x=y CONFIG_MPC834x=y

Просмотреть файл

@ -3,7 +3,13 @@ menu "Platform support"
choice choice
prompt "Machine Type" prompt "Machine Type"
default MPC834x_SYS default MPC834x_MDS
config MPC8313_RDB
bool "Freescale MPC8313 RDB"
select DEFAULT_UIMAGE
help
This option enables support for the MPC8313 RDB board.
config MPC832x_MDS config MPC832x_MDS
bool "Freescale MPC832x MDS" bool "Freescale MPC832x MDS"
@ -12,13 +18,13 @@ config MPC832x_MDS
help help
This option enables support for the MPC832x MDS evaluation board. This option enables support for the MPC832x MDS evaluation board.
config MPC834x_SYS config MPC834x_MDS
bool "Freescale MPC834x SYS" bool "Freescale MPC834x MDS"
select DEFAULT_UIMAGE select DEFAULT_UIMAGE
help help
This option enables support for the MPC 834x SYS evaluation board. This option enables support for the MPC 834x MDS evaluation board.
Be aware that PCI buses can only function when SYS board is plugged Be aware that PCI buses can only function when MDS board is plugged
into the PIB (Platform IO Board) board from Freescale which provide into the PIB (Platform IO Board) board from Freescale which provide
3 PCI slots. The PIBs PCI initialization is the bootloader's 3 PCI slots. The PIBs PCI initialization is the bootloader's
responsibility. responsibility.
@ -41,6 +47,12 @@ config MPC8360E_PB
endchoice endchoice
config PPC_MPC831x
bool
select PPC_UDBG_16550
select PPC_INDIRECT_PCI
default y if MPC8313_RDB
config PPC_MPC832x config PPC_MPC832x
bool bool
select PPC_UDBG_16550 select PPC_UDBG_16550
@ -51,7 +63,7 @@ config MPC834x
bool bool
select PPC_UDBG_16550 select PPC_UDBG_16550
select PPC_INDIRECT_PCI select PPC_INDIRECT_PCI
default y if MPC834x_SYS || MPC834x_ITX default y if MPC834x_MDS || MPC834x_ITX
config PPC_MPC836x config PPC_MPC836x
bool bool

Просмотреть файл

@ -3,7 +3,8 @@
# #
obj-y := misc.o obj-y := misc.o
obj-$(CONFIG_PCI) += pci.o obj-$(CONFIG_PCI) += pci.o
obj-$(CONFIG_MPC834x_SYS) += mpc834x_sys.o obj-$(CONFIG_MPC8313_RDB) += mpc8313_rdb.o
obj-$(CONFIG_MPC834x_MDS) += mpc834x_mds.o
obj-$(CONFIG_MPC834x_ITX) += mpc834x_itx.o obj-$(CONFIG_MPC834x_ITX) += mpc834x_itx.o
obj-$(CONFIG_MPC8360E_PB) += mpc8360e_pb.o obj-$(CONFIG_MPC8360E_PB) += mpc8360e_pb.o
obj-$(CONFIG_MPC832x_MDS) += mpc832x_mds.o obj-$(CONFIG_MPC832x_MDS) += mpc832x_mds.o

Просмотреть файл

@ -0,0 +1,99 @@
/*
* arch/powerpc/platforms/83xx/mpc8313_rdb.c
*
* Description: MPC8313x RDB board specific routines.
* This file is based on mpc834x_sys.c
* Author: Lo Wlison <r43300@freescale.com>
*
* Copyright (C) Freescale Semiconductor, Inc. 2006. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*/
#include <linux/pci.h>
#include <asm/time.h>
#include <asm/ipic.h>
#include <asm/udbg.h>
#include "mpc83xx.h"
#undef DEBUG
#ifdef DEBUG
#define DBG(fmt...) udbg_printf(fmt)
#else
#define DBG(fmt...)
#endif
#ifndef CONFIG_PCI
unsigned long isa_io_base = 0;
unsigned long isa_mem_base = 0;
#endif
/* ************************************************************************
*
* Setup the architecture
*
*/
static void __init mpc8313_rdb_setup_arch(void)
{
struct device_node *np;
if (ppc_md.progress)
ppc_md.progress("mpc8313_rdb_setup_arch()", 0);
#ifdef CONFIG_PCI
for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
add_bridge(np);
ppc_md.pci_exclude_device = mpc83xx_exclude_device;
#endif
}
void __init mpc8313_rdb_init_IRQ(void)
{
struct device_node *np;
np = of_find_node_by_type(NULL, "ipic");
if (!np)
return;
ipic_init(np, 0);
/* Initialize the default interrupt mapping priorities,
* in case the boot rom changed something on us.
*/
ipic_set_default_priority();
}
/*
* Called very early, MMU is off, device-tree isn't unflattened
*/
static int __init mpc8313_rdb_probe(void)
{
char *model = of_get_flat_dt_prop(of_get_flat_dt_root(),
"model", NULL);
if (model == NULL)
return 0;
if (strcmp(model, "MPC8313ERDB"))
return 0;
DBG("MPC8313 RDB found\n");
return 1;
}
define_machine(mpc8313_rdb) {
.name = "MPC8313 RDB",
.probe = mpc8313_rdb_probe,
.setup_arch = mpc8313_rdb_setup_arch,
.init_IRQ = mpc8313_rdb_init_IRQ,
.get_irq = ipic_get_irq,
.restart = mpc83xx_restart,
.time_init = mpc83xx_time_init,
.calibrate_decr = generic_calibrate_decr,
.progress = udbg_progress,
};

Просмотреть файл

@ -38,8 +38,6 @@
#include "mpc83xx.h" #include "mpc83xx.h"
#include <platforms/83xx/mpc834x_sys.h>
#ifndef CONFIG_PCI #ifndef CONFIG_PCI
unsigned long isa_io_base = 0; unsigned long isa_io_base = 0;
unsigned long isa_mem_base = 0; unsigned long isa_mem_base = 0;

Просмотреть файл

@ -1,7 +1,7 @@
/* /*
* arch/powerpc/platforms/83xx/mpc834x_sys.c * arch/powerpc/platforms/83xx/mpc834x_mds.c
* *
* MPC834x SYS board specific routines * MPC834x MDS board specific routines
* *
* Maintainer: Kumar Gala <galak@kernel.crashing.org> * Maintainer: Kumar Gala <galak@kernel.crashing.org>
* *
@ -43,17 +43,87 @@ unsigned long isa_io_base = 0;
unsigned long isa_mem_base = 0; unsigned long isa_mem_base = 0;
#endif #endif
#define BCSR5_INT_USB 0x02
/* Note: This is only for PB, not for PB+PIB
* On PB only port0 is connected using ULPI */
static int mpc834x_usb_cfg(void)
{
unsigned long sccr, sicrl;
void __iomem *immap;
void __iomem *bcsr_regs = NULL;
u8 bcsr5;
struct device_node *np = NULL;
int port0_is_dr = 0;
if ((np = of_find_compatible_node(np, "usb", "fsl-usb2-dr")) != NULL)
port0_is_dr = 1;
if ((np = of_find_compatible_node(np, "usb", "fsl-usb2-mph")) != NULL){
if (port0_is_dr) {
printk(KERN_WARNING
"There is only one USB port on PB board! \n");
return -1;
} else if (!port0_is_dr)
/* No usb port enabled */
return -1;
}
immap = ioremap(get_immrbase(), 0x1000);
if (!immap)
return -1;
/* Configure clock */
sccr = in_be32(immap + MPC83XX_SCCR_OFFS);
if (port0_is_dr)
sccr |= MPC83XX_SCCR_USB_DRCM_11; /* 1:3 */
else
sccr |= MPC83XX_SCCR_USB_MPHCM_11; /* 1:3 */
out_be32(immap + MPC83XX_SCCR_OFFS, sccr);
/* Configure Pin */
sicrl = in_be32(immap + MPC83XX_SICRL_OFFS);
/* set port0 only */
if (port0_is_dr)
sicrl |= MPC83XX_SICRL_USB0;
else
sicrl &= ~(MPC83XX_SICRL_USB0);
out_be32(immap + MPC83XX_SICRL_OFFS, sicrl);
iounmap(immap);
/* Map BCSR area */
np = of_find_node_by_name(NULL, "bcsr");
if (np != 0) {
struct resource res;
of_address_to_resource(np, 0, &res);
bcsr_regs = ioremap(res.start, res.end - res.start + 1);
of_node_put(np);
}
if (!bcsr_regs)
return -1;
/*
* if MDS board is plug into PIB board,
* force to use the PHY on MDS board
*/
bcsr5 = in_8(bcsr_regs + 5);
if (!(bcsr5 & BCSR5_INT_USB))
out_8(bcsr_regs + 5, (bcsr5 | BCSR5_INT_USB));
iounmap(bcsr_regs);
return 0;
}
/* ************************************************************************ /* ************************************************************************
* *
* Setup the architecture * Setup the architecture
* *
*/ */
static void __init mpc834x_sys_setup_arch(void) static void __init mpc834x_mds_setup_arch(void)
{ {
struct device_node *np; struct device_node *np;
if (ppc_md.progress) if (ppc_md.progress)
ppc_md.progress("mpc834x_sys_setup_arch()", 0); ppc_md.progress("mpc834x_mds_setup_arch()", 0);
np = of_find_node_by_type(NULL, "cpu"); np = of_find_node_by_type(NULL, "cpu");
if (np != 0) { if (np != 0) {
@ -65,6 +135,7 @@ static void __init mpc834x_sys_setup_arch(void)
loops_per_jiffy = 50000000 / HZ; loops_per_jiffy = 50000000 / HZ;
of_node_put(np); of_node_put(np);
} }
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;) for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
add_bridge(np); add_bridge(np);
@ -72,6 +143,8 @@ static void __init mpc834x_sys_setup_arch(void)
ppc_md.pci_exclude_device = mpc83xx_exclude_device; ppc_md.pci_exclude_device = mpc83xx_exclude_device;
#endif #endif
mpc834x_usb_cfg();
#ifdef CONFIG_ROOT_NFS #ifdef CONFIG_ROOT_NFS
ROOT_DEV = Root_NFS; ROOT_DEV = Root_NFS;
#else #else
@ -79,7 +152,7 @@ static void __init mpc834x_sys_setup_arch(void)
#endif #endif
} }
static void __init mpc834x_sys_init_IRQ(void) static void __init mpc834x_mds_init_IRQ(void)
{ {
struct device_node *np; struct device_node *np;
@ -119,7 +192,7 @@ late_initcall(mpc834x_rtc_hookup);
/* /*
* Called very early, MMU is off, device-tree isn't unflattened * Called very early, MMU is off, device-tree isn't unflattened
*/ */
static int __init mpc834x_sys_probe(void) static int __init mpc834x_mds_probe(void)
{ {
/* We always match for now, eventually we should look at the flat /* We always match for now, eventually we should look at the flat
dev tree to ensure this is the board we are suppose to run on dev tree to ensure this is the board we are suppose to run on
@ -127,11 +200,11 @@ static int __init mpc834x_sys_probe(void)
return 1; return 1;
} }
define_machine(mpc834x_sys) { define_machine(mpc834x_mds) {
.name = "MPC834x SYS", .name = "MPC834x MDS",
.probe = mpc834x_sys_probe, .probe = mpc834x_mds_probe,
.setup_arch = mpc834x_sys_setup_arch, .setup_arch = mpc834x_mds_setup_arch,
.init_IRQ = mpc834x_sys_init_IRQ, .init_IRQ = mpc834x_mds_init_IRQ,
.get_irq = ipic_get_irq, .get_irq = ipic_get_irq,
.restart = mpc83xx_restart, .restart = mpc83xx_restart,
.time_init = mpc83xx_time_init, .time_init = mpc83xx_time_init,

Просмотреть файл

@ -1,23 +0,0 @@
/*
* arch/powerpc/platforms/83xx/mpc834x_sys.h
*
* MPC834X SYS common board definitions
*
* Maintainer: Kumar Gala <galak@kernel.crashing.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
*/
#ifndef __MACH_MPC83XX_SYS_H__
#define __MACH_MPC83XX_SYS_H__
#define PIRQA MPC83xx_IRQ_EXT4
#define PIRQB MPC83xx_IRQ_EXT5
#define PIRQC MPC83xx_IRQ_EXT6
#define PIRQD MPC83xx_IRQ_EXT7
#endif /* __MACH_MPC83XX_SYS_H__ */

Просмотреть файл

@ -4,6 +4,24 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/device.h> #include <linux/device.h>
/* System Clock Control Register */
#define MPC83XX_SCCR_OFFS 0xA08
#define MPC83XX_SCCR_USB_MPHCM_11 0x00c00000
#define MPC83XX_SCCR_USB_MPHCM_01 0x00400000
#define MPC83XX_SCCR_USB_MPHCM_10 0x00800000
#define MPC83XX_SCCR_USB_DRCM_11 0x00300000
#define MPC83XX_SCCR_USB_DRCM_01 0x00100000
#define MPC83XX_SCCR_USB_DRCM_10 0x00200000
/* system i/o configuration register low */
#define MPC83XX_SICRL_OFFS 0x114
#define MPC83XX_SICRL_USB0 0x40000000
#define MPC83XX_SICRL_USB1 0x20000000
/* system i/o configuration register high */
#define MPC83XX_SICRH_OFFS 0x118
#define MPC83XX_SICRH_USB_UTMI 0x00020000
/* /*
* Declaration for the various functions exported by the * Declaration for the various functions exported by the
* mpc83xx_* files. Mostly for use by mpc83xx_setup * mpc83xx_* files. Mostly for use by mpc83xx_setup

Просмотреть файл

@ -441,7 +441,8 @@ static int __init fsl_usb_of_init(void)
{ {
struct device_node *np; struct device_node *np;
unsigned int i; unsigned int i;
struct platform_device *usb_dev_mph = NULL, *usb_dev_dr = NULL; struct platform_device *usb_dev_mph = NULL, *usb_dev_dr_host = NULL,
*usb_dev_dr_client = NULL;
int ret; int ret;
for (np = NULL, i = 0; for (np = NULL, i = 0;
@ -507,33 +508,72 @@ static int __init fsl_usb_of_init(void)
of_irq_to_resource(np, 0, &r[1]); of_irq_to_resource(np, 0, &r[1]);
usb_dev_dr = prop = get_property(np, "dr_mode", NULL);
platform_device_register_simple("fsl-ehci", i, r, 2);
if (IS_ERR(usb_dev_dr)) { if (!prop || !strcmp(prop, "host")) {
ret = PTR_ERR(usb_dev_dr); usb_data.operating_mode = FSL_USB2_DR_HOST;
usb_dev_dr_host = platform_device_register_simple(
"fsl-ehci", i, r, 2);
if (IS_ERR(usb_dev_dr_host)) {
ret = PTR_ERR(usb_dev_dr_host);
goto err;
}
} else if (prop && !strcmp(prop, "peripheral")) {
usb_data.operating_mode = FSL_USB2_DR_DEVICE;
usb_dev_dr_client = platform_device_register_simple(
"fsl-usb2-udc", i, r, 2);
if (IS_ERR(usb_dev_dr_client)) {
ret = PTR_ERR(usb_dev_dr_client);
goto err;
}
} else if (prop && !strcmp(prop, "otg")) {
usb_data.operating_mode = FSL_USB2_DR_OTG;
usb_dev_dr_host = platform_device_register_simple(
"fsl-ehci", i, r, 2);
if (IS_ERR(usb_dev_dr_host)) {
ret = PTR_ERR(usb_dev_dr_host);
goto err;
}
usb_dev_dr_client = platform_device_register_simple(
"fsl-usb2-udc", i, r, 2);
if (IS_ERR(usb_dev_dr_client)) {
ret = PTR_ERR(usb_dev_dr_client);
goto err;
}
} else {
ret = -EINVAL;
goto err; goto err;
} }
usb_dev_dr->dev.coherent_dma_mask = 0xffffffffUL;
usb_dev_dr->dev.dma_mask = &usb_dev_dr->dev.coherent_dma_mask;
usb_data.operating_mode = FSL_USB2_DR_HOST;
prop = get_property(np, "phy_type", NULL); prop = get_property(np, "phy_type", NULL);
usb_data.phy_mode = determine_usb_phy(prop); usb_data.phy_mode = determine_usb_phy(prop);
ret = if (usb_dev_dr_host) {
platform_device_add_data(usb_dev_dr, &usb_data, usb_dev_dr_host->dev.coherent_dma_mask = 0xffffffffUL;
sizeof(struct usb_dev_dr_host->dev.dma_mask = &usb_dev_dr_host->
fsl_usb2_platform_data)); dev.coherent_dma_mask;
if (ret) if ((ret = platform_device_add_data(usb_dev_dr_host,
goto unreg_dr; &usb_data, sizeof(struct
fsl_usb2_platform_data))))
goto unreg_dr;
}
if (usb_dev_dr_client) {
usb_dev_dr_client->dev.coherent_dma_mask = 0xffffffffUL;
usb_dev_dr_client->dev.dma_mask = &usb_dev_dr_client->
dev.coherent_dma_mask;
if ((ret = platform_device_add_data(usb_dev_dr_client,
&usb_data, sizeof(struct
fsl_usb2_platform_data))))
goto unreg_dr;
}
} }
return 0; return 0;
unreg_dr: unreg_dr:
if (usb_dev_dr) if (usb_dev_dr_host)
platform_device_unregister(usb_dev_dr); platform_device_unregister(usb_dev_dr_host);
if (usb_dev_dr_client)
platform_device_unregister(usb_dev_dr_client);
unreg_mph: unreg_mph:
if (usb_dev_mph) if (usb_dev_mph)
platform_device_unregister(usb_dev_mph); platform_device_unregister(usb_dev_mph);
@ -699,7 +739,7 @@ static int __init fs_enet_of_init(void)
if (ret) if (ret)
goto unreg; goto unreg;
} }
of_node_put(phy); of_node_put(phy);
of_node_put(mdio); of_node_put(mdio);