Path: blob/master/arch/powerpc/platforms/44x/canyonlands.c
10820 views
/*1* This contain platform specific code for APM PPC460EX based Canyonlands2* board.3*4* Copyright (c) 2010, Applied Micro Circuits Corporation5* Author: Rupjyoti Sarmah <[email protected]>6*7* This program is free software; you can redistribute it and/or8* modify it under the terms of the GNU General Public License as9* published by the Free Software Foundation; either version 2 of10* the License, or (at your option) any later version.11*12* This program is distributed in the hope that it will be useful,13* but WITHOUT ANY WARRANTY; without even the implied warranty of14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the15* GNU General Public License for more details.16*17* You should have received a copy of the GNU General Public License18* along with this program; if not, write to the Free Software19* Foundation, Inc., 59 Temple Place, Suite 330, Boston,20* MA 02111-1307 USA21*22*/23#include <linux/kernel.h>24#include <linux/init.h>25#include <asm/pci-bridge.h>26#include <asm/ppc4xx.h>27#include <asm/udbg.h>28#include <asm/uic.h>29#include <linux/of_platform.h>30#include <linux/delay.h>31#include "44x.h"3233#define BCSR_USB_EN 0x113435static __initdata struct of_device_id ppc460ex_of_bus[] = {36{ .compatible = "ibm,plb4", },37{ .compatible = "ibm,opb", },38{ .compatible = "ibm,ebc", },39{ .compatible = "simple-bus", },40{},41};4243static int __init ppc460ex_device_probe(void)44{45of_platform_bus_probe(NULL, ppc460ex_of_bus, NULL);4647return 0;48}49machine_device_initcall(canyonlands, ppc460ex_device_probe);5051/* Using this code only for the Canyonlands board. */5253static int __init ppc460ex_probe(void)54{55unsigned long root = of_get_flat_dt_root();56if (of_flat_dt_is_compatible(root, "amcc,canyonlands")) {57ppc_pci_set_flags(PPC_PCI_REASSIGN_ALL_RSRC);58return 1;59}60return 0;61}6263/* USB PHY fixup code on Canyonlands kit. */6465static int __init ppc460ex_canyonlands_fixup(void)66{67u8 __iomem *bcsr ;68void __iomem *vaddr;69struct device_node *np;70int ret = 0;7172np = of_find_compatible_node(NULL, NULL, "amcc,ppc460ex-bcsr");73if (!np) {74printk(KERN_ERR "failed did not find amcc, ppc460ex bcsr node\n");75return -ENODEV;76}7778bcsr = of_iomap(np, 0);79of_node_put(np);8081if (!bcsr) {82printk(KERN_CRIT "Could not remap bcsr\n");83ret = -ENODEV;84goto err_bcsr;85}8687np = of_find_compatible_node(NULL, NULL, "ibm,ppc4xx-gpio");88if (!np) {89printk(KERN_ERR "failed did not find ibm,ppc4xx-gpio node\n");90return -ENODEV;91}9293vaddr = of_iomap(np, 0);94of_node_put(np);9596if (!vaddr) {97printk(KERN_CRIT "Could not get gpio node address\n");98ret = -ENODEV;99goto err_gpio;100}101/* Disable USB, through the BCSR7 bits */102setbits8(&bcsr[7], BCSR_USB_EN);103104/* Wait for a while after reset */105msleep(100);106107/* Enable USB here */108clrbits8(&bcsr[7], BCSR_USB_EN);109110/*111* Configure multiplexed gpio16 and gpio19 as alternate1 output112* source after USB reset. In this configuration gpio16 will be113* USB2HStop and gpio19 will be USB2DStop. For more details refer to114* table 34-7 of PPC460EX user manual.115*/116setbits32((vaddr + GPIO0_OSRH), 0x42000000);117setbits32((vaddr + GPIO0_TSRH), 0x42000000);118err_gpio:119iounmap(vaddr);120err_bcsr:121iounmap(bcsr);122return ret;123}124machine_device_initcall(canyonlands, ppc460ex_canyonlands_fixup);125define_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};134135136