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

TOMOYO Linux Cross Reference
Linux/arch/powerpc/platforms/83xx/mpc837x_mds.c

Version: ~ [ linux-6.1-rc7 ] ~ [ linux-6.0.10 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.80 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.156 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.225 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.267 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.300 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.334 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.302 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ 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  * arch/powerpc/platforms/83xx/mpc837x_mds.c
  3  *
  4  * Copyright (C) 2007 Freescale Semiconductor, Inc. All rights reserved.
  5  *
  6  * MPC837x MDS 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.h>
 16 #include <linux/of_platform.h>
 17 
 18 #include <asm/time.h>
 19 #include <asm/ipic.h>
 20 #include <asm/udbg.h>
 21 #include <asm/prom.h>
 22 #include <sysdev/fsl_pci.h>
 23 
 24 #include "mpc83xx.h"
 25 
 26 #define BCSR12_USB_SER_MASK     0x8a
 27 #define BCSR12_USB_SER_PIN      0x80
 28 #define BCSR12_USB_SER_DEVICE   0x02
 29 
 30 static int mpc837xmds_usb_cfg(void)
 31 {
 32         struct device_node *np;
 33         const void *phy_type, *mode;
 34         void __iomem *bcsr_regs = NULL;
 35         u8 bcsr12;
 36         int ret;
 37 
 38         ret = mpc837x_usb_cfg();
 39         if (ret)
 40                 return ret;
 41         /* Map BCSR area */
 42         np = of_find_compatible_node(NULL, NULL, "fsl,mpc837xmds-bcsr");
 43         if (np) {
 44                 bcsr_regs = of_iomap(np, 0);
 45                 of_node_put(np);
 46         }
 47         if (!bcsr_regs)
 48                 return -1;
 49 
 50         np = of_find_node_by_name(NULL, "usb");
 51         if (!np) {
 52                 ret = -ENODEV;
 53                 goto out;
 54         }
 55         phy_type = of_get_property(np, "phy_type", NULL);
 56         if (phy_type && !strcmp(phy_type, "ulpi")) {
 57                 clrbits8(bcsr_regs + 12, BCSR12_USB_SER_PIN);
 58         } else if (phy_type && !strcmp(phy_type, "serial")) {
 59                 mode = of_get_property(np, "dr_mode", NULL);
 60                 bcsr12 = in_8(bcsr_regs + 12) & ~BCSR12_USB_SER_MASK;
 61                 bcsr12 |= BCSR12_USB_SER_PIN;
 62                 if (mode && !strcmp(mode, "peripheral"))
 63                         bcsr12 |= BCSR12_USB_SER_DEVICE;
 64                 out_8(bcsr_regs + 12, bcsr12);
 65         } else {
 66                 printk(KERN_ERR "USB DR: unsupported PHY\n");
 67         }
 68 
 69         of_node_put(np);
 70 out:
 71         iounmap(bcsr_regs);
 72         return ret;
 73 }
 74 
 75 /* ************************************************************************
 76  *
 77  * Setup the architecture
 78  *
 79  */
 80 static void __init mpc837x_mds_setup_arch(void)
 81 {
 82         mpc83xx_setup_arch();
 83         mpc837xmds_usb_cfg();
 84 }
 85 
 86 machine_device_initcall(mpc837x_mds, mpc83xx_declare_of_platform_devices);
 87 
 88 /*
 89  * Called very early, MMU is off, device-tree isn't unflattened
 90  */
 91 static int __init mpc837x_mds_probe(void)
 92 {
 93         return of_machine_is_compatible("fsl,mpc837xmds");
 94 }
 95 
 96 define_machine(mpc837x_mds) {
 97         .name                   = "MPC837x MDS",
 98         .probe                  = mpc837x_mds_probe,
 99         .setup_arch             = mpc837x_mds_setup_arch,
100         .init_IRQ               = mpc83xx_ipic_init_IRQ,
101         .get_irq                = ipic_get_irq,
102         .restart                = mpc83xx_restart,
103         .time_init              = mpc83xx_time_init,
104         .calibrate_decr         = generic_calibrate_decr,
105         .progress               = udbg_progress,
106 };
107 

~ [ 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