Kim Phillips | 38f66f9 | 2008-01-24 20:47:11 -0600 | [diff] [blame] | 1 | /* |
| 2 | * arch/powerpc/platforms/83xx/mpc837x_rdb.c |
| 3 | * |
| 4 | * Copyright (C) 2007 Freescale Semicondutor, Inc. All rights reserved. |
| 5 | * |
| 6 | * MPC837x RDB board specific routines |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify it |
| 9 | * under the terms of the GNU General Public License as published by the |
| 10 | * Free Software Foundation; either version 2 of the License, or (at your |
| 11 | * option) any later version. |
| 12 | */ |
| 13 | |
| 14 | #include <linux/pci.h> |
| 15 | #include <linux/of_platform.h> |
| 16 | |
| 17 | #include <asm/time.h> |
| 18 | #include <asm/ipic.h> |
| 19 | #include <asm/udbg.h> |
Anton Vorontsov | 89f3729 | 2009-07-25 01:42:30 +0400 | [diff] [blame] | 20 | #include <sysdev/fsl_soc.h> |
John Rigby | 76fe1ff | 2008-06-26 11:07:57 -0600 | [diff] [blame] | 21 | #include <sysdev/fsl_pci.h> |
Kim Phillips | 38f66f9 | 2008-01-24 20:47:11 -0600 | [diff] [blame] | 22 | |
| 23 | #include "mpc83xx.h" |
| 24 | |
Anton Vorontsov | 89f3729 | 2009-07-25 01:42:30 +0400 | [diff] [blame] | 25 | static void mpc837x_rdb_sd_cfg(void) |
| 26 | { |
| 27 | void __iomem *im; |
| 28 | |
| 29 | im = ioremap(get_immrbase(), 0x1000); |
| 30 | if (!im) { |
| 31 | WARN_ON(1); |
| 32 | return; |
| 33 | } |
| 34 | |
| 35 | /* |
| 36 | * On RDB boards (in contrast to MDS) USBB pins are used for SD only, |
| 37 | * so we can safely mux them away from the USB block. |
| 38 | */ |
| 39 | clrsetbits_be32(im + MPC83XX_SICRL_OFFS, MPC837X_SICRL_USBB_MASK, |
| 40 | MPC837X_SICRL_SD); |
| 41 | clrsetbits_be32(im + MPC83XX_SICRH_OFFS, MPC837X_SICRH_SPI_MASK, |
| 42 | MPC837X_SICRH_SD); |
| 43 | iounmap(im); |
| 44 | } |
| 45 | |
Kim Phillips | 38f66f9 | 2008-01-24 20:47:11 -0600 | [diff] [blame] | 46 | /* ************************************************************************ |
| 47 | * |
| 48 | * Setup the architecture |
| 49 | * |
| 50 | */ |
| 51 | static void __init mpc837x_rdb_setup_arch(void) |
| 52 | { |
| 53 | #ifdef CONFIG_PCI |
| 54 | struct device_node *np; |
| 55 | #endif |
| 56 | |
| 57 | if (ppc_md.progress) |
| 58 | ppc_md.progress("mpc837x_rdb_setup_arch()", 0); |
| 59 | |
| 60 | #ifdef CONFIG_PCI |
| 61 | for_each_compatible_node(np, "pci", "fsl,mpc8349-pci") |
| 62 | mpc83xx_add_bridge(np); |
Anton Vorontsov | 0585a15 | 2009-01-08 04:31:41 +0300 | [diff] [blame] | 63 | for_each_compatible_node(np, "pci", "fsl,mpc8314-pcie") |
| 64 | mpc83xx_add_bridge(np); |
Kim Phillips | 38f66f9 | 2008-01-24 20:47:11 -0600 | [diff] [blame] | 65 | #endif |
| 66 | mpc837x_usb_cfg(); |
Anton Vorontsov | 89f3729 | 2009-07-25 01:42:30 +0400 | [diff] [blame] | 67 | mpc837x_rdb_sd_cfg(); |
Kim Phillips | 38f66f9 | 2008-01-24 20:47:11 -0600 | [diff] [blame] | 68 | } |
| 69 | |
| 70 | static struct of_device_id mpc837x_ids[] = { |
| 71 | { .type = "soc", }, |
| 72 | { .compatible = "soc", }, |
Anton Vorontsov | 9c43279 | 2008-03-18 18:43:59 +0300 | [diff] [blame] | 73 | { .compatible = "simple-bus", }, |
Anton Vorontsov | 70b3adb | 2009-03-19 21:01:45 +0300 | [diff] [blame] | 74 | { .compatible = "gianfar", }, |
Anton Vorontsov | 6971df4 | 2010-05-02 21:27:05 +0400 | [diff] [blame] | 75 | { .compatible = "gpio-leds", }, |
Kim Phillips | 38f66f9 | 2008-01-24 20:47:11 -0600 | [diff] [blame] | 76 | {}, |
| 77 | }; |
| 78 | |
| 79 | static int __init mpc837x_declare_of_platform_devices(void) |
| 80 | { |
Grant Likely | 2dc1158 | 2010-08-06 09:25:50 -0600 | [diff] [blame^] | 81 | /* Publish platform_device */ |
Kim Phillips | 38f66f9 | 2008-01-24 20:47:11 -0600 | [diff] [blame] | 82 | of_platform_bus_probe(NULL, mpc837x_ids, NULL); |
| 83 | |
| 84 | return 0; |
| 85 | } |
| 86 | machine_device_initcall(mpc837x_rdb, mpc837x_declare_of_platform_devices); |
| 87 | |
| 88 | static void __init mpc837x_rdb_init_IRQ(void) |
| 89 | { |
| 90 | struct device_node *np; |
| 91 | |
| 92 | np = of_find_compatible_node(NULL, NULL, "fsl,ipic"); |
| 93 | if (!np) |
| 94 | return; |
| 95 | |
| 96 | ipic_init(np, 0); |
| 97 | |
| 98 | /* Initialize the default interrupt mapping priorities, |
| 99 | * in case the boot rom changed something on us. |
| 100 | */ |
| 101 | ipic_set_default_priority(); |
| 102 | } |
| 103 | |
| 104 | /* |
| 105 | * Called very early, MMU is off, device-tree isn't unflattened |
| 106 | */ |
| 107 | static int __init mpc837x_rdb_probe(void) |
| 108 | { |
| 109 | unsigned long root = of_get_flat_dt_root(); |
| 110 | |
| 111 | return of_flat_dt_is_compatible(root, "fsl,mpc8377rdb") || |
| 112 | of_flat_dt_is_compatible(root, "fsl,mpc8378rdb") || |
Anton Vorontsov | fda4bd9 | 2009-07-25 01:42:17 +0400 | [diff] [blame] | 113 | of_flat_dt_is_compatible(root, "fsl,mpc8379rdb") || |
| 114 | of_flat_dt_is_compatible(root, "fsl,mpc8377wlan"); |
Kim Phillips | 38f66f9 | 2008-01-24 20:47:11 -0600 | [diff] [blame] | 115 | } |
| 116 | |
| 117 | define_machine(mpc837x_rdb) { |
Anton Vorontsov | fda4bd9 | 2009-07-25 01:42:17 +0400 | [diff] [blame] | 118 | .name = "MPC837x RDB/WLAN", |
Kim Phillips | 38f66f9 | 2008-01-24 20:47:11 -0600 | [diff] [blame] | 119 | .probe = mpc837x_rdb_probe, |
| 120 | .setup_arch = mpc837x_rdb_setup_arch, |
| 121 | .init_IRQ = mpc837x_rdb_init_IRQ, |
| 122 | .get_irq = ipic_get_irq, |
| 123 | .restart = mpc83xx_restart, |
| 124 | .time_init = mpc83xx_time_init, |
| 125 | .calibrate_decr = generic_calibrate_decr, |
| 126 | .progress = udbg_progress, |
| 127 | }; |