11 #include <linux/kernel.h>
15 #include <linux/bitops.h>
16 #include <linux/device.h>
36 #include <asm/types.h>
37 #include <asm/setup.h>
38 #include <asm/memory.h>
45 #include <mach/hardware.h>
47 #include <mach/irqs.h>
82 static void __init u300_map_io(
void)
86 init_consistent_dma_size(
SZ_4M);
95 #ifdef CONFIG_COH901318
108 #ifdef CONFIG_COH901318
127 #define U300_MMCSD_IRQS { IRQ_U300_MMCSD_MCIINTR0, IRQ_U300_MMCSD_MCIINTR1 }
140 #ifdef CONFIG_COH901318
154 static struct amba_device *amba_devs[] __initdata = {
166 static struct resource gpio_resources[] = {
216 static struct resource keypad_resources[] = {
223 .name =
"coh901461-press",
229 .name =
"coh901461-release",
236 static struct resource rtc_resources[] = {
253 static struct resource fsmc_resources[] = {
268 static struct resource i2c0_resources[] = {
281 static struct resource i2c1_resources[] = {
295 static struct resource wdog_resources[] = {
308 static struct resource dma_resource[] = {
325 static int dma_slave_channels[] = {
330 static int dma_memcpy_channels[] = {
338 static void coh901318_access_memory_state(
struct device *
dev,
bool active)
342 #define flags_memcpy_config (COH901318_CX_CFG_CH_DISABLE | \
343 COH901318_CX_CFG_RM_MEMORY_TO_MEMORY | \
344 COH901318_CX_CFG_LCR_DISABLE | \
345 COH901318_CX_CFG_TC_IRQ_ENABLE | \
346 COH901318_CX_CFG_BE_IRQ_ENABLE)
347 #define flags_memcpy_lli_chained (COH901318_CX_CTRL_TC_ENABLE | \
348 COH901318_CX_CTRL_BURST_COUNT_32_BYTES | \
349 COH901318_CX_CTRL_SRC_BUS_SIZE_32_BITS | \
350 COH901318_CX_CTRL_SRC_ADDR_INC_ENABLE | \
351 COH901318_CX_CTRL_DST_BUS_SIZE_32_BITS | \
352 COH901318_CX_CTRL_DST_ADDR_INC_ENABLE | \
353 COH901318_CX_CTRL_MASTER_MODE_M1RW | \
354 COH901318_CX_CTRL_TCP_DISABLE | \
355 COH901318_CX_CTRL_TC_IRQ_DISABLE | \
356 COH901318_CX_CTRL_HSP_DISABLE | \
357 COH901318_CX_CTRL_HSS_DISABLE | \
358 COH901318_CX_CTRL_DDMA_LEGACY | \
359 COH901318_CX_CTRL_PRDD_SOURCE)
360 #define flags_memcpy_lli (COH901318_CX_CTRL_TC_ENABLE | \
361 COH901318_CX_CTRL_BURST_COUNT_32_BYTES | \
362 COH901318_CX_CTRL_SRC_BUS_SIZE_32_BITS | \
363 COH901318_CX_CTRL_SRC_ADDR_INC_ENABLE | \
364 COH901318_CX_CTRL_DST_BUS_SIZE_32_BITS | \
365 COH901318_CX_CTRL_DST_ADDR_INC_ENABLE | \
366 COH901318_CX_CTRL_MASTER_MODE_M1RW | \
367 COH901318_CX_CTRL_TCP_DISABLE | \
368 COH901318_CX_CTRL_TC_IRQ_DISABLE | \
369 COH901318_CX_CTRL_HSP_DISABLE | \
370 COH901318_CX_CTRL_HSS_DISABLE | \
371 COH901318_CX_CTRL_DDMA_LEGACY | \
372 COH901318_CX_CTRL_PRDD_SOURCE)
373 #define flags_memcpy_lli_last (COH901318_CX_CTRL_TC_ENABLE | \
374 COH901318_CX_CTRL_BURST_COUNT_32_BYTES | \
375 COH901318_CX_CTRL_SRC_BUS_SIZE_32_BITS | \
376 COH901318_CX_CTRL_SRC_ADDR_INC_ENABLE | \
377 COH901318_CX_CTRL_DST_BUS_SIZE_32_BITS | \
378 COH901318_CX_CTRL_DST_ADDR_INC_ENABLE | \
379 COH901318_CX_CTRL_MASTER_MODE_M1RW | \
380 COH901318_CX_CTRL_TCP_DISABLE | \
381 COH901318_CX_CTRL_TC_IRQ_ENABLE | \
382 COH901318_CX_CTRL_HSP_DISABLE | \
383 COH901318_CX_CTRL_HSS_DISABLE | \
384 COH901318_CX_CTRL_DDMA_LEGACY | \
385 COH901318_CX_CTRL_PRDD_SOURCE)
403 .param.ctrl_lli_chained = 0 |
417 .param.ctrl_lli = 0 |
431 .param.ctrl_lli_last = 0 |
455 .param.ctrl_lli_chained = 0 |
469 .param.ctrl_lli = 0 |
483 .param.ctrl_lli_last = 0 |
508 .param.ctrl_lli_chained = 0 |
522 .param.ctrl_lli = 0 |
536 .param.ctrl_lli_last = 0 |
560 .param.ctrl_lli_chained = 0 |
574 .param.ctrl_lli = 0 |
588 .param.ctrl_lli_last = 0 |
630 .param.ctrl_lli_chained = 0 |
645 .param.ctrl_lli_last = 0 |
669 .param.ctrl_lli_chained = 0 |
683 .param.ctrl_lli = 0 |
697 .param.ctrl_lli_last = 0 |
721 .param.ctrl_lli_chained = 0 |
735 .param.ctrl_lli = 0 |
749 .param.ctrl_lli_last = 0 |
773 .param.ctrl_lli_chained = 0 |
787 .param.ctrl_lli = 0 |
801 .param.ctrl_lli_last = 0 |
825 .param.ctrl_lli_chained = 0 |
839 .param.ctrl_lli = 0 |
853 .param.ctrl_lli_last = 0 |
881 .name =
"MMCSD RX TX",
887 .param.ctrl_lli_chained = 0 |
895 .param.ctrl_lli = 0 |
903 .param.ctrl_lli_last = 0 |
936 .param.ctrl_lli_chained = 0 |
944 .param.ctrl_lli = 0 |
952 .param.ctrl_lli_last = 0 |
969 .param.ctrl_lli_chained = 0 |
977 .param.ctrl_lli = 0 |
985 .param.ctrl_lli_last = 0 |
1006 .name =
"PCM I2S0 TX",
1013 .param.ctrl_lli_chained = 0 |
1027 .param.ctrl_lli = 0 |
1041 .param.ctrl_lli_last = 0 |
1058 .name =
"PCM I2S0 RX",
1065 .param.ctrl_lli_chained = 0 |
1079 .param.ctrl_lli = 0 |
1093 .param.ctrl_lli_last = 0 |
1110 .name =
"PCM I2S1 TX",
1117 .param.ctrl_lli_chained = 0 |
1131 .param.ctrl_lli = 0 |
1145 .param.ctrl_lli_last = 0 |
1162 .name =
"PCM I2S1 RX",
1169 .param.ctrl_lli_chained = 0 |
1183 .param.ctrl_lli = 0 |
1197 .param.ctrl_lli_last = 0 |
1235 .param.ctrl_lli_chained = 0 |
1243 .param.ctrl_lli = 0 |
1251 .param.ctrl_lli_last = 0 |
1268 .param.ctrl_lli_chained = 0 |
1276 .param.ctrl_lli = 0 |
1284 .param.ctrl_lli_last = 0 |
1296 .name =
"GENERAL 00",
1306 .name =
"GENERAL 01",
1316 .name =
"GENERAL 02",
1326 .name =
"GENERAL 03",
1336 .name =
"GENERAL 04",
1346 .name =
"GENERAL 05",
1356 .name =
"GENERAL 06",
1366 .name =
"GENERAL 07",
1376 .name =
"GENERAL 08",
1399 .chans_memcpy = dma_memcpy_channels,
1400 .access_memory_state = coh901318_access_memory_state,
1405 static struct resource pinctrl_resources[] = {
1414 .name =
"coh901327_wdog",
1417 .resource = wdog_resources,
1424 .resource = i2c0_resources,
1431 .resource = i2c1_resources,
1435 .name =
"pinctrl-u300",
1437 .num_resources =
ARRAY_SIZE(pinctrl_resources),
1438 .resource = pinctrl_resources,
1448 .gpio_irq_base = IRQ_U300_GPIO_BASE,
1453 .name =
"u300-gpio",
1456 .resource = gpio_resources,
1458 .platform_data = &u300_gpio_plat,
1465 .num_resources =
ARRAY_SIZE(keypad_resources),
1470 .
name =
"rtc-coh901331",
1473 .resource = rtc_resources,
1478 .name =
"bootrecords",
1485 .size = 8064 *
SZ_1K,
1489 .offset = 8192 *
SZ_1K,
1490 .size = 253952 *
SZ_1K,
1495 .partitions = u300_partitions,
1496 .nr_partitions =
ARRAY_SIZE(u300_partitions),
1504 .name =
"fsmc-nand",
1506 .resource = fsmc_resources,
1509 .platform_data = &nand_platform_data,
1514 .name =
"coh901318",
1516 .resource = dma_resource,
1519 .platform_data = &coh901318_platform,
1520 .coherent_dma_mask = ~0,
1524 static unsigned long pin_pullup_conf[] = {
1525 PIN_CONF_PACKED(PIN_CONFIG_BIAS_PULL_UP, 1),
1528 static unsigned long pin_highz_conf[] = {
1529 PIN_CONF_PACKED(PIN_CONFIG_BIAS_HIGH_IMPEDANCE, 0),
1533 static struct pinctrl_map __initdata u300_pinmux_map[] = {
1557 .dev = &uart0_device.dev,
1560 .dev = &mmcsd_device.dev,
1564 static int __init u300_pinctrl_fetch(
void)
1568 for (i = 0; i <
ARRAY_SIZE(u300_mux_hogs); i++) {
1571 p = pinctrl_get_select_default(u300_mux_hogs[i].dev);
1573 pr_err(
"u300: could not get pinmux hog for dev %s\n",
1574 dev_name(u300_mux_hogs[i].dev));
1577 u300_mux_hogs[
i].
p =
p;
1603 static void __init u300_init_irq(
void)
1615 clk_prepare_enable(clk);
1618 clk_prepare_enable(clk);
1623 clk_prepare_enable(clk);
1626 set_bit(i, (
unsigned long *) &mask[0]);
1645 static struct db_chip db_chips[] __initdata = {
1672 .name =
"DB3350 P1x",
1676 .name =
"DB3350 P2x",
1684 static void __init u300_init_check_chip(
void)
1689 const char *chipname;
1690 const char unknown[] =
"UNKNOWN";
1695 val = (val & 0xFF
U) << 8 | (val >> 8);
1699 for ( ; chip->
chipid; chip++) {
1700 if (chip->
chipid == (val & 0xFF00U)) {
1701 chipname = chip->
name;
1706 "(chip ID 0x%04x)\n", chipname, val);
1708 if ((val & 0xFF00U) != 0xf000 && (val & 0xFF00U) != 0xf100) {
1710 " with DB3350 but %s detected, expect problems!",
1720 static void __init u300_assign_physmem(
void)
1722 unsigned long curr_start =
__pa(high_memory);
1725 for (i = 0; i <
ARRAY_SIZE(platform_devs); i++) {
1726 for (j = 0; j < platform_devs[
i]->num_resources; j++) {
1728 &platform_devs[
i]->resource[
j];
1732 res->
start = curr_start;
1733 res->
end += curr_start;
1734 curr_start += resource_size(res);
1737 "%#x-%#x to device %s:%s\n",
1739 platform_devs[i]->name, res->
name);
1745 static void __init u300_init_machine(
void)
1751 u300_init_check_chip();
1757 for (i = 0; i <
ARRAY_SIZE(amba_devs); i++) {
1762 u300_assign_physmem();
1786 static void u300_restart(
char mode,
const char *
cmd)
1791 #ifdef CONFIG_COH901327_WATCHDOG
1803 MACHINE_START(U300,
"Ericsson AB U335 S335/B335 Prototype Board")
1805 .atag_offset = 0x100,
1806 .map_io = u300_map_io,
1808 .init_irq = u300_init_irq,
1811 .init_machine = u300_init_machine,
1812 .restart = u300_restart,