Path: blob/master/arch/powerpc/platforms/83xx/usb_837x.c
26481 views
// SPDX-License-Identifier: GPL-2.0-or-later1/*2* Freescale 83xx USB SOC setup code3*4* Copyright (C) 2007 Freescale Semiconductor, Inc.5* Author: Li Yang6*/78#include <linux/stddef.h>9#include <linux/kernel.h>10#include <linux/errno.h>11#include <linux/of.h>12#include <linux/of_address.h>13#include <linux/io.h>1415#include <sysdev/fsl_soc.h>1617#include "mpc83xx.h"1819int __init mpc837x_usb_cfg(void)20{21void __iomem *immap;22struct device_node *np = NULL;23const void *prop;24int ret = 0;2526np = of_find_compatible_node(NULL, NULL, "fsl-usb2-dr");27if (!np || !of_device_is_available(np)) {28of_node_put(np);29return -ENODEV;30}31prop = of_get_property(np, "phy_type", NULL);3233if (!prop || (strcmp(prop, "ulpi") && strcmp(prop, "serial"))) {34pr_warn("837x USB PHY type not supported\n");35of_node_put(np);36return -EINVAL;37}3839/* Map IMMR space for pin and clock settings */40immap = ioremap(get_immrbase(), 0x1000);41if (!immap) {42of_node_put(np);43return -ENOMEM;44}4546/* Configure clock */47clrsetbits_be32(immap + MPC83XX_SCCR_OFFS, MPC837X_SCCR_USB_DRCM_11,48MPC837X_SCCR_USB_DRCM_11);4950/* Configure pin mux for ULPI/serial */51clrsetbits_be32(immap + MPC83XX_SICRL_OFFS, MPC837X_SICRL_USB_MASK,52MPC837X_SICRL_USB_ULPI);5354iounmap(immap);55of_node_put(np);56return ret;57}585960