2013-03-21 18:03:38 +08:00
|
|
|
/*
|
|
|
|
* Bock-W board support
|
|
|
|
*
|
|
|
|
* Copyright (C) 2013 Renesas Solutions Corp.
|
|
|
|
* Copyright (C) 2013 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
|
|
|
|
*
|
|
|
|
* 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; version 2 of the License.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
2013-04-12 13:38:03 +08:00
|
|
|
#include <linux/pinctrl/machine.h>
|
2013-03-21 18:03:38 +08:00
|
|
|
#include <linux/platform_device.h>
|
2013-04-02 12:20:02 +08:00
|
|
|
#include <linux/smsc911x.h>
|
2013-03-21 18:03:38 +08:00
|
|
|
#include <mach/common.h>
|
2013-04-02 12:20:02 +08:00
|
|
|
#include <mach/irqs.h>
|
2013-03-21 18:03:38 +08:00
|
|
|
#include <mach/r8a7778.h>
|
|
|
|
#include <asm/mach/arch.h>
|
|
|
|
|
2013-04-02 12:20:02 +08:00
|
|
|
static struct smsc911x_platform_config smsc911x_data = {
|
|
|
|
.irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
|
|
|
|
.irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
|
|
|
|
.flags = SMSC911X_USE_32BIT,
|
|
|
|
.phy_interface = PHY_INTERFACE_MODE_MII,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct resource smsc911x_resources[] = {
|
|
|
|
DEFINE_RES_MEM(0x18300000, 0x1000),
|
|
|
|
DEFINE_RES_IRQ(irq_pin(0)), /* IRQ 0 */
|
|
|
|
};
|
|
|
|
|
2013-06-09 04:38:41 +08:00
|
|
|
static struct rcar_phy_platform_data usb_phy_platform_data __initdata;
|
|
|
|
|
2013-04-12 13:38:03 +08:00
|
|
|
static const struct pinctrl_map bockw_pinctrl_map[] = {
|
|
|
|
/* SCIF0 */
|
|
|
|
PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.0", "pfc-r8a7778",
|
|
|
|
"scif0_data_a", "scif0"),
|
|
|
|
PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.0", "pfc-r8a7778",
|
|
|
|
"scif0_ctrl", "scif0"),
|
2013-06-09 04:38:41 +08:00
|
|
|
PIN_MAP_MUX_GROUP_DEFAULT("ehci-platform", "pfc-r8a7778",
|
|
|
|
"usb0", "usb0"),
|
|
|
|
PIN_MAP_MUX_GROUP_DEFAULT("ehci-platform", "pfc-r8a7778",
|
|
|
|
"usb1", "usb1"),
|
2013-04-12 13:38:03 +08:00
|
|
|
};
|
|
|
|
|
2013-04-02 12:20:02 +08:00
|
|
|
#define IRQ0MR 0x30
|
2013-03-21 18:03:38 +08:00
|
|
|
static void __init bockw_init(void)
|
|
|
|
{
|
2013-04-02 12:20:02 +08:00
|
|
|
void __iomem *fpga;
|
|
|
|
|
2013-03-21 18:03:38 +08:00
|
|
|
r8a7778_clock_init();
|
2013-04-02 12:20:02 +08:00
|
|
|
r8a7778_init_irq_extpin(1);
|
2013-03-21 18:03:38 +08:00
|
|
|
r8a7778_add_standard_devices();
|
2013-06-09 04:38:41 +08:00
|
|
|
r8a7778_add_usb_phy_device(&usb_phy_platform_data);
|
2013-04-02 12:20:02 +08:00
|
|
|
|
2013-04-12 13:38:03 +08:00
|
|
|
pinctrl_register_mappings(bockw_pinctrl_map,
|
|
|
|
ARRAY_SIZE(bockw_pinctrl_map));
|
|
|
|
r8a7778_pinmux_init();
|
|
|
|
|
2013-04-02 12:20:02 +08:00
|
|
|
fpga = ioremap_nocache(0x18200000, SZ_1M);
|
|
|
|
if (fpga) {
|
|
|
|
/*
|
|
|
|
* CAUTION
|
|
|
|
*
|
|
|
|
* IRQ0/1 is cascaded interrupt from FPGA.
|
|
|
|
* it should be cared in the future
|
|
|
|
* Now, it is assuming IRQ0 was used only from SMSC.
|
|
|
|
*/
|
|
|
|
u16 val = ioread16(fpga + IRQ0MR);
|
|
|
|
val &= ~(1 << 4); /* enable SMSC911x */
|
|
|
|
iowrite16(val, fpga + IRQ0MR);
|
|
|
|
iounmap(fpga);
|
|
|
|
|
|
|
|
platform_device_register_resndata(
|
|
|
|
&platform_bus, "smsc911x", -1,
|
|
|
|
smsc911x_resources, ARRAY_SIZE(smsc911x_resources),
|
|
|
|
&smsc911x_data, sizeof(smsc911x_data));
|
|
|
|
}
|
2013-03-21 18:03:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static const char *bockw_boards_compat_dt[] __initdata = {
|
|
|
|
"renesas,bockw",
|
|
|
|
NULL,
|
|
|
|
};
|
|
|
|
|
|
|
|
DT_MACHINE_START(BOCKW_DT, "bockw")
|
|
|
|
.init_early = r8a7778_init_delay,
|
|
|
|
.init_irq = r8a7778_init_irq_dt,
|
|
|
|
.init_machine = bockw_init,
|
|
|
|
.init_time = shmobile_timer_init,
|
|
|
|
.dt_compat = bockw_boards_compat_dt,
|
2013-06-09 04:38:41 +08:00
|
|
|
.init_late = r8a7778_init_late,
|
2013-03-21 18:03:38 +08:00
|
|
|
MACHINE_END
|