Path: blob/master/arch/powerpc/platforms/44x/canyonlands.c
26481 views
// SPDX-License-Identifier: GPL-2.0-or-later1/*2* This contain platform specific code for APM PPC460EX based Canyonlands3* board.4*5* Copyright (c) 2010, Applied Micro Circuits Corporation6* Author: Rupjyoti Sarmah <[email protected]>7*/8#include <linux/kernel.h>9#include <linux/init.h>10#include <asm/pci-bridge.h>11#include <asm/ppc4xx.h>12#include <asm/udbg.h>13#include <asm/uic.h>14#include <linux/of_address.h>15#include <linux/of_platform.h>16#include <linux/delay.h>17#include "44x.h"1819#define BCSR_USB_EN 0x112021static const struct of_device_id ppc460ex_of_bus[] __initconst = {22{ .compatible = "ibm,plb4", },23{ .compatible = "ibm,opb", },24{ .compatible = "ibm,ebc", },25{ .compatible = "simple-bus", },26{},27};2829static int __init ppc460ex_device_probe(void)30{31of_platform_bus_probe(NULL, ppc460ex_of_bus, NULL);3233return 0;34}35machine_device_initcall(canyonlands, ppc460ex_device_probe);3637/* Using this code only for the Canyonlands board. */3839static int __init ppc460ex_probe(void)40{41pci_set_flags(PCI_REASSIGN_ALL_RSRC);4243return 1;44}4546/* USB PHY fixup code on Canyonlands kit. */4748static int __init ppc460ex_canyonlands_fixup(void)49{50u8 __iomem *bcsr ;51void __iomem *vaddr;52struct device_node *np;53int ret = 0;5455np = of_find_compatible_node(NULL, NULL, "amcc,ppc460ex-bcsr");56if (!np) {57printk(KERN_ERR "failed did not find amcc, ppc460ex bcsr node\n");58return -ENODEV;59}6061bcsr = of_iomap(np, 0);62of_node_put(np);6364if (!bcsr) {65printk(KERN_CRIT "Could not remap bcsr\n");66ret = -ENODEV;67goto err_bcsr;68}6970np = of_find_compatible_node(NULL, NULL, "ibm,ppc4xx-gpio");71if (!np) {72printk(KERN_ERR "failed did not find ibm,ppc4xx-gpio node\n");73return -ENODEV;74}7576vaddr = of_iomap(np, 0);77of_node_put(np);7879if (!vaddr) {80printk(KERN_CRIT "Could not get gpio node address\n");81ret = -ENODEV;82goto err_gpio;83}84/* Disable USB, through the BCSR7 bits */85setbits8(&bcsr[7], BCSR_USB_EN);8687/* Wait for a while after reset */88msleep(100);8990/* Enable USB here */91clrbits8(&bcsr[7], BCSR_USB_EN);9293/*94* Configure multiplexed gpio16 and gpio19 as alternate1 output95* source after USB reset. In this configuration gpio16 will be96* USB2HStop and gpio19 will be USB2DStop. For more details refer to97* table 34-7 of PPC460EX user manual.98*/99setbits32((vaddr + GPIO0_OSRH), 0x42000000);100setbits32((vaddr + GPIO0_TSRH), 0x42000000);101err_gpio:102iounmap(vaddr);103err_bcsr:104iounmap(bcsr);105return ret;106}107machine_device_initcall(canyonlands, ppc460ex_canyonlands_fixup);108define_machine(canyonlands) {109.name = "Canyonlands",110.compatible = "amcc,canyonlands",111.probe = ppc460ex_probe,112.progress = udbg_progress,113.init_IRQ = uic_init_tree,114.get_irq = uic_get_irq,115.restart = ppc4xx_reset_system,116};117118119