Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 163515
b: refs/heads/master
c: c3144fc
h: refs/heads/master
i:
  163513: 9a9e003
  163511: 3c9dfe3
v: v3
  • Loading branch information
Paul Mundt committed Aug 23, 2009
1 parent 01386aa commit f013a5e
Show file tree
Hide file tree
Showing 60 changed files with 8,393 additions and 467 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cc58f597afc63a57bb55ed97c2a72f7405320c93
refs/heads/master: c3144fc46f987413df10e83659f0bf1aad76f79e
7 changes: 7 additions & 0 deletions trunk/arch/sh/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,13 @@ config CPU_SUBTYPE_SH7724
help
Select SH7724 if you have an SH-MobileR2R CPU.

config CPU_SUBTYPE_SH7757
bool "Support SH7757 processor"
select CPU_SH4A
select CPU_SHX2
help
Select SH7757 if you have a SH4A SH7757 CPU.

config CPU_SUBTYPE_SH7763
bool "Support SH7763 processor"
select CPU_SH4A
Expand Down
1 change: 1 addition & 0 deletions trunk/arch/sh/Kconfig.debug
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ config EARLY_SCIF_CONSOLE_PORT
default "0xffe00000" if CPU_SUBTYPE_SH7780 || CPU_SUBTYPE_SH7763 || \
CPU_SUBTYPE_SH7722 || CPU_SUBTYPE_SH7366 || \
CPU_SUBTYPE_SH7343
default "0xfe4c0000" if CPU_SUBTYPE_SH7757
default "0xffeb0000" if CPU_SUBTYPE_SH7785
default "0xffeb0000" if CPU_SUBTYPE_SH7786
default "0xfffe8000" if CPU_SUBTYPE_SH7203
Expand Down
1 change: 1 addition & 0 deletions trunk/arch/sh/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ machdir-$(CONFIG_SH_EDOSK7705) += mach-edosk7705
machdir-$(CONFIG_SH_HIGHLANDER) += mach-highlander
machdir-$(CONFIG_SH_MIGOR) += mach-migor
machdir-$(CONFIG_SH_KFR2R09) += mach-kfr2r09
machdir-$(CONFIG_SH_ECOVEC) += mach-ecovec24
machdir-$(CONFIG_SH_SDK7780) += mach-sdk7780
machdir-$(CONFIG_SH_X3PROTO) += mach-x3proto
machdir-$(CONFIG_SH_SH7763RDP) += mach-sh7763rdp
Expand Down
7 changes: 7 additions & 0 deletions trunk/arch/sh/boards/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,13 @@ config SH_KFR2R09
help
"Kit For R2R for 2009" support.

config SH_ECOVEC
bool "EcoVec"
depends on CPU_SUBTYPE_SH7724
select ARCH_REQUIRE_GPIOLIB
help
Renesas "R0P7724LC0011/21RL (EcoVec)" support.

config SH_SH7763RDP
bool "SH7763RDP"
depends on CPU_SUBTYPE_SH7763
Expand Down
9 changes: 9 additions & 0 deletions trunk/arch/sh/boards/mach-ecovec24/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# Makefile for the R0P7724LC0011/21RL (EcoVec)
#
# This file is subject to the terms and conditions of the GNU General Public
# License. See the file "COPYING" in the main directory of this archive
# for more details.
#

obj-y := setup.o
129 changes: 129 additions & 0 deletions trunk/arch/sh/boards/mach-ecovec24/setup.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
/*
* Copyright (C) 2009 Renesas Solutions Corp.
*
* Kuninori Morimoto <morimoto.kuninori@renesas.com>
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*/

#include <linux/init.h>
#include <linux/device.h>
#include <linux/platform_device.h>
#include <linux/mtd/physmap.h>
#include <linux/gpio.h>
#include <linux/interrupt.h>
#include <asm/io.h>
#include <asm/heartbeat.h>
#include <cpu/sh7724.h>

/*
* Area Address Interface size BusWidth
* 0 0x0000_0000 ~ 0x03FF_FFFF FROM 64MB 16bit
* 1 0x0400_0000 ~ 0x07FF_FFFF Internal I/O 64MB 16/32bit
* 2 0x0800_0000 ~ 0x0BFF_FFFF DRAM 2 64MB 32bit
* 3 0x0C00_0000 ~ 0x0FFF_FFFF DRAM 3 64MB 32bit
* 4 0x1000_0000 ~ 0x13FF_FFFF DRAM 4 64MB 32bit
* 5 0x1400_0000 ~ 0x17FF_FFFF DRAM 5 64MB 32bit
* 6 0x1800_0000 ~ 0x1BFF_FFFF MFI 64MB 16bit
*/

/* Heartbeat */
static unsigned char led_pos[] = { 0, 1, 2, 3 };
static struct heartbeat_data heartbeat_data = {
.regsize = 8,
.nr_bits = 4,
.bit_pos = led_pos,
};

static struct resource heartbeat_resources[] = {
[0] = {
.start = 0xA405012C, /* PTG */
.end = 0xA405012E - 1,
.flags = IORESOURCE_MEM,
},
};

static struct platform_device heartbeat_device = {
.name = "heartbeat",
.id = -1,
.dev = {
.platform_data = &heartbeat_data,
},
.num_resources = ARRAY_SIZE(heartbeat_resources),
.resource = heartbeat_resources,
};

/* MTD */
static struct mtd_partition nor_flash_partitions[] = {
{
.name = "uboot",
.offset = 0,
.size = (256 * 1024),
.mask_flags = MTD_CAP_ROM,
}, {
.name = "kernel",
.offset = MTDPART_OFS_APPEND,
.size = (2 * 1024 * 1024),
}, {
.name = "free-area",
.offset = MTDPART_OFS_APPEND,
.size = MTDPART_SIZ_FULL,
},
};

static struct physmap_flash_data nor_flash_data = {
.width = 2,
.parts = nor_flash_partitions,
.nr_parts = ARRAY_SIZE(nor_flash_partitions),
};

static struct resource nor_flash_resources[] = {
[0] = {
.name = "NOR Flash",
.start = 0x00000000,
.end = 0x03ffffff,
.flags = IORESOURCE_MEM,
}
};

static struct platform_device nor_flash_device = {
.name = "physmap-flash",
.resource = nor_flash_resources,
.num_resources = ARRAY_SIZE(nor_flash_resources),
.dev = {
.platform_data = &nor_flash_data,
},
};

static struct platform_device *ecovec_devices[] __initdata = {
&heartbeat_device,
&nor_flash_device,
};

static int __init devices_setup(void)
{
/* enable SCIFA0 */
gpio_request(GPIO_FN_SCIF0_TXD, NULL);
gpio_request(GPIO_FN_SCIF0_RXD, NULL);
gpio_request(GPIO_FN_SCIF0_SCK, NULL);

/* enable debug LED */
gpio_request(GPIO_PTG0, NULL);
gpio_request(GPIO_PTG1, NULL);
gpio_request(GPIO_PTG2, NULL);
gpio_request(GPIO_PTG3, NULL);
gpio_direction_output(GPIO_PTT0, 0);
gpio_direction_output(GPIO_PTT1, 0);
gpio_direction_output(GPIO_PTT2, 0);
gpio_direction_output(GPIO_PTT3, 0);

return platform_add_devices(ecovec_devices,
ARRAY_SIZE(ecovec_devices));
}
device_initcall(devices_setup);

static struct sh_machine_vector mv_ecovec __initmv = {
.mv_name = "R0P7724 (EcoVec)",
};
110 changes: 110 additions & 0 deletions trunk/arch/sh/boards/mach-kfr2r09/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include <linux/clk.h>
#include <linux/gpio.h>
#include <linux/input.h>
#include <linux/i2c.h>
#include <linux/usb/r8a66597.h>
#include <video/sh_mobile_lcdc.h>
#include <asm/clock.h>
#include <asm/machvec.h>
Expand Down Expand Up @@ -181,6 +183,35 @@ static struct platform_device kfr2r09_sh_lcdc_device = {
},
};

static struct r8a66597_platdata kfr2r09_usb0_gadget_data = {
.on_chip = 1,
};

static struct resource kfr2r09_usb0_gadget_resources[] = {
[0] = {
.start = 0x04d80000,
.end = 0x04d80123,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = 65,
.end = 65,
.flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
},
};

static struct platform_device kfr2r09_usb0_gadget_device = {
.name = "r8a66597_udc",
.id = 0,
.dev = {
.dma_mask = NULL, /* not use dma */
.coherent_dma_mask = 0xffffffff,
.platform_data = &kfr2r09_usb0_gadget_data,
},
.num_resources = ARRAY_SIZE(kfr2r09_usb0_gadget_resources),
.resource = kfr2r09_usb0_gadget_resources,
};

static struct platform_device *kfr2r09_devices[] __initdata = {
&kfr2r09_nor_flash_device,
&kfr2r09_nand_flash_device,
Expand All @@ -192,6 +223,81 @@ static struct platform_device *kfr2r09_devices[] __initdata = {
#define BSC_CS0WCR 0xfec10024
#define BSC_CS4BCR 0xfec10010
#define BSC_CS4WCR 0xfec10030
#define PORT_MSELCRB 0xa4050182

#ifdef CONFIG_I2C
static int kfr2r09_usb0_gadget_i2c_setup(void)
{
struct i2c_adapter *a;
struct i2c_msg msg;
unsigned char buf[2];
int ret;

a = i2c_get_adapter(0);
if (!a)
return -ENODEV;

/* set bit 1 (the second bit) of chip at 0x09, register 0x13 */
buf[0] = 0x13;
msg.addr = 0x09;
msg.buf = buf;
msg.len = 1;
msg.flags = 0;
ret = i2c_transfer(a, &msg, 1);
if (ret != 1)
return -ENODEV;

buf[0] = 0;
msg.addr = 0x09;
msg.buf = buf;
msg.len = 1;
msg.flags = I2C_M_RD;
ret = i2c_transfer(a, &msg, 1);
if (ret != 1)
return -ENODEV;

buf[1] = buf[0] | (1 << 1);
buf[0] = 0x13;
msg.addr = 0x09;
msg.buf = buf;
msg.len = 2;
msg.flags = 0;
ret = i2c_transfer(a, &msg, 1);
if (ret != 1)
return -ENODEV;

return 0;
}
#else
static int kfr2r09_usb0_gadget_i2c_setup(void)
{
return -ENODEV;
}
#endif

static int kfr2r09_usb0_gadget_setup(void)
{
int plugged_in;

gpio_request(GPIO_PTN4, NULL); /* USB_DET */
gpio_direction_input(GPIO_PTN4);
plugged_in = gpio_get_value(GPIO_PTN4);
if (!plugged_in)
return -ENODEV; /* no cable plugged in */

if (kfr2r09_usb0_gadget_i2c_setup() != 0)
return -ENODEV; /* unable to configure using i2c */

ctrl_outw((ctrl_inw(PORT_MSELCRB) & ~0xc000) | 0x8000, PORT_MSELCRB);
gpio_request(GPIO_FN_PDSTATUS, NULL); /* R-standby disables USB clock */
gpio_request(GPIO_PTV6, NULL); /* USBCLK_ON */
gpio_direction_output(GPIO_PTV6, 1); /* USBCLK_ON = H */
msleep(20); /* wait 20ms to let the clock settle */
clk_enable(clk_get(NULL, "usb0"));
ctrl_outw(0x0600, 0xa40501d4);

return 0;
}

static int __init kfr2r09_devices_setup(void)
{
Expand Down Expand Up @@ -251,6 +357,10 @@ static int __init kfr2r09_devices_setup(void)
gpio_request(GPIO_PTU0, NULL); /* LEDSTDBY/ */
gpio_direction_output(GPIO_PTU0, 1);

/* setup USB function */
if (kfr2r09_usb0_gadget_setup() == 0)
platform_device_register(&kfr2r09_usb0_gadget_device);

return platform_add_devices(kfr2r09_devices,
ARRAY_SIZE(kfr2r09_devices));
}
Expand Down
35 changes: 34 additions & 1 deletion trunk/arch/sh/boards/mach-se/7724/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ static struct r8a66597_platdata sh7724_usb0_host_data = {
static struct resource sh7724_usb0_host_resources[] = {
[0] = {
.start = 0xa4d80000,
.end = 0xa4d800ff,
.end = 0xa4d80124 - 1,
.flags = IORESOURCE_MEM,
},
[1] = {
Expand All @@ -359,6 +359,35 @@ static struct platform_device sh7724_usb0_host_device = {
},
};

static struct r8a66597_platdata sh7724_usb1_gadget_data = {
.on_chip = 1,
};

static struct resource sh7724_usb1_gadget_resources[] = {
[0] = {
.start = 0xa4d90000,
.end = 0xa4d90123,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = 66,
.end = 66,
.flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
},
};

static struct platform_device sh7724_usb1_gadget_device = {
.name = "r8a66597_udc",
.id = 1, /* USB1 */
.dev = {
.dma_mask = NULL, /* not use dma */
.coherent_dma_mask = 0xffffffff,
.platform_data = &sh7724_usb1_gadget_data,
},
.num_resources = ARRAY_SIZE(sh7724_usb1_gadget_resources),
.resource = sh7724_usb1_gadget_resources,
};

static struct platform_device *ms7724se_devices[] __initdata = {
&heartbeat_device,
&smc91x_eth_device,
Expand All @@ -369,6 +398,7 @@ static struct platform_device *ms7724se_devices[] __initdata = {
&keysc_device,
&sh_eth_device,
&sh7724_usb0_host_device,
&sh7724_usb1_gadget_device,
};

#define EEPROM_OP 0xBA206000
Expand Down Expand Up @@ -477,6 +507,9 @@ static int __init devices_setup(void)
/* enable USB0 port */
ctrl_outw(0x0600, 0xa40501d4);

/* enable USB1 port */
ctrl_outw(0x0600, 0xa4050192);

/* enable IRQ 0,1,2 */
gpio_request(GPIO_FN_INTC_IRQ0, NULL);
gpio_request(GPIO_FN_INTC_IRQ1, NULL);
Expand Down
Loading

0 comments on commit f013a5e

Please sign in to comment.