~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/powerpc/platforms/44x/canyonlands.c

Version: ~ [ linux-6.3-rc3 ] ~ [ linux-6.2.7 ] ~ [ linux-6.1.20 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.103 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.175 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.237 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.278 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.310 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * This contain platform specific code for APM PPC460EX based Canyonlands
  3  * board.
  4  *
  5  * Copyright (c) 2010, Applied Micro Circuits Corporation
  6  * Author: Rupjyoti Sarmah <rsarmah@apm.com>
  7  *
  8  * This program is free software; you can redistribute it and/or
  9  * modify it under the terms of the GNU General Public License as
 10  * published by the Free Software Foundation; either version 2 of
 11  * the License, or (at your option) any later version.
 12  *
 13  * This program is distributed in the hope that it will be useful,
 14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 16  * GNU General Public License for more details.
 17  *
 18  * You should have received a copy of the GNU General Public License
 19  * along with this program; if not, write to the Free Software
 20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 21  * MA 02111-1307 USA
 22  *
 23  */
 24 #include <linux/kernel.h>
 25 #include <linux/init.h>
 26 #include <asm/pci-bridge.h>
 27 #include <asm/ppc4xx.h>
 28 #include <asm/udbg.h>
 29 #include <asm/uic.h>
 30 #include <linux/of_platform.h>
 31 #include <linux/delay.h>
 32 #include "44x.h"
 33 
 34 #define BCSR_USB_EN     0x11
 35 
 36 static const struct of_device_id ppc460ex_of_bus[] __initconst = {
 37         { .compatible = "ibm,plb4", },
 38         { .compatible = "ibm,opb", },
 39         { .compatible = "ibm,ebc", },
 40         { .compatible = "simple-bus", },
 41         {},
 42 };
 43 
 44 static int __init ppc460ex_device_probe(void)
 45 {
 46         of_platform_bus_probe(NULL, ppc460ex_of_bus, NULL);
 47 
 48         return 0;
 49 }
 50 machine_device_initcall(canyonlands, ppc460ex_device_probe);
 51 
 52 /* Using this code only for the Canyonlands board.  */
 53 
 54 static int __init ppc460ex_probe(void)
 55 {
 56         if (of_machine_is_compatible("amcc,canyonlands")) {
 57                 pci_set_flags(PCI_REASSIGN_ALL_RSRC);
 58                 return 1;
 59         }
 60         return 0;
 61 }
 62 
 63 /* USB PHY fixup code on Canyonlands kit. */
 64 
 65 static int __init ppc460ex_canyonlands_fixup(void)
 66 {
 67         u8 __iomem *bcsr ;
 68         void __iomem *vaddr;
 69         struct device_node *np;
 70         int ret = 0;
 71 
 72         np = of_find_compatible_node(NULL, NULL, "amcc,ppc460ex-bcsr");
 73         if (!np) {
 74                 printk(KERN_ERR "failed did not find amcc, ppc460ex bcsr node\n");
 75                 return -ENODEV;
 76         }
 77 
 78         bcsr = of_iomap(np, 0);
 79         of_node_put(np);
 80 
 81         if (!bcsr) {
 82                 printk(KERN_CRIT "Could not remap bcsr\n");
 83                 ret = -ENODEV;
 84                 goto err_bcsr;
 85         }
 86 
 87         np = of_find_compatible_node(NULL, NULL, "ibm,ppc4xx-gpio");
 88         if (!np) {
 89                 printk(KERN_ERR "failed did not find ibm,ppc4xx-gpio node\n");
 90                 return -ENODEV;
 91         }
 92 
 93         vaddr = of_iomap(np, 0);
 94         of_node_put(np);
 95 
 96         if (!vaddr) {
 97                 printk(KERN_CRIT "Could not get gpio node address\n");
 98                 ret = -ENODEV;
 99                 goto err_gpio;
100         }
101         /* Disable USB, through the BCSR7 bits */
102         setbits8(&bcsr[7], BCSR_USB_EN);
103 
104         /* Wait for a while after reset */
105         msleep(100);
106 
107         /* Enable USB here */
108         clrbits8(&bcsr[7], BCSR_USB_EN);
109 
110         /*
111          * Configure multiplexed gpio16 and gpio19 as alternate1 output
112          * source after USB reset. In this configuration gpio16 will be
113          * USB2HStop and gpio19 will be USB2DStop. For more details refer to
114          * table 34-7 of PPC460EX user manual.
115          */
116         setbits32((vaddr + GPIO0_OSRH), 0x42000000);
117         setbits32((vaddr + GPIO0_TSRH), 0x42000000);
118 err_gpio:
119         iounmap(vaddr);
120 err_bcsr:
121         iounmap(bcsr);
122         return ret;
123 }
124 machine_device_initcall(canyonlands, ppc460ex_canyonlands_fixup);
125 define_machine(canyonlands) {
126         .name = "Canyonlands",
127         .probe = ppc460ex_probe,
128         .progress = udbg_progress,
129         .init_IRQ = uic_init_tree,
130         .get_irq = uic_get_irq,
131         .restart = ppc4xx_reset_system,
132         .calibrate_decr = generic_calibrate_decr,
133 };
134 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp