Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /* Analogue & Micro Adder MPC875 board support
0003  *
0004  * Author: Scott Wood <scottwood@freescale.com>
0005  *
0006  * Copyright (c) 2007 Freescale Semiconductor, Inc.
0007  */
0008 
0009 #include <linux/init.h>
0010 #include <linux/fs_enet_pd.h>
0011 #include <linux/of_platform.h>
0012 
0013 #include <asm/time.h>
0014 #include <asm/machdep.h>
0015 #include <asm/cpm1.h>
0016 #include <asm/fs_pd.h>
0017 #include <asm/udbg.h>
0018 
0019 #include "mpc8xx.h"
0020 #include "pic.h"
0021 
0022 struct cpm_pin {
0023     int port, pin, flags;
0024 };
0025 
0026 static __initdata struct cpm_pin adder875_pins[] = {
0027     /* SMC1 */
0028     {CPM_PORTB, 24, CPM_PIN_INPUT}, /* RX */
0029     {CPM_PORTB, 25, CPM_PIN_INPUT | CPM_PIN_SECONDARY}, /* TX */
0030 
0031     /* MII1 */
0032     {CPM_PORTA, 0, CPM_PIN_INPUT},
0033     {CPM_PORTA, 1, CPM_PIN_INPUT},
0034     {CPM_PORTA, 2, CPM_PIN_INPUT},
0035     {CPM_PORTA, 3, CPM_PIN_INPUT},
0036     {CPM_PORTA, 4, CPM_PIN_OUTPUT},
0037     {CPM_PORTA, 10, CPM_PIN_OUTPUT},
0038     {CPM_PORTA, 11, CPM_PIN_OUTPUT},
0039     {CPM_PORTB, 19, CPM_PIN_INPUT},
0040     {CPM_PORTB, 31, CPM_PIN_INPUT},
0041     {CPM_PORTC, 12, CPM_PIN_INPUT},
0042     {CPM_PORTC, 13, CPM_PIN_INPUT},
0043     {CPM_PORTE, 30, CPM_PIN_OUTPUT},
0044     {CPM_PORTE, 31, CPM_PIN_OUTPUT},
0045 
0046     /* MII2 */
0047     {CPM_PORTE, 14, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY},
0048     {CPM_PORTE, 15, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY},
0049     {CPM_PORTE, 16, CPM_PIN_OUTPUT},
0050     {CPM_PORTE, 17, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY},
0051     {CPM_PORTE, 18, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY},
0052     {CPM_PORTE, 19, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY},
0053     {CPM_PORTE, 20, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY},
0054     {CPM_PORTE, 21, CPM_PIN_OUTPUT},
0055     {CPM_PORTE, 22, CPM_PIN_OUTPUT},
0056     {CPM_PORTE, 23, CPM_PIN_OUTPUT},
0057     {CPM_PORTE, 24, CPM_PIN_OUTPUT},
0058     {CPM_PORTE, 25, CPM_PIN_OUTPUT},
0059     {CPM_PORTE, 26, CPM_PIN_OUTPUT},
0060     {CPM_PORTE, 27, CPM_PIN_OUTPUT},
0061     {CPM_PORTE, 28, CPM_PIN_OUTPUT},
0062     {CPM_PORTE, 29, CPM_PIN_OUTPUT},
0063 };
0064 
0065 static void __init init_ioports(void)
0066 {
0067     int i;
0068 
0069     for (i = 0; i < ARRAY_SIZE(adder875_pins); i++) {
0070         const struct cpm_pin *pin = &adder875_pins[i];
0071         cpm1_set_pin(pin->port, pin->pin, pin->flags);
0072     }
0073 
0074     cpm1_clk_setup(CPM_CLK_SMC1, CPM_BRG1, CPM_CLK_RTX);
0075 
0076     /* Set FEC1 and FEC2 to MII mode */
0077     clrbits32(&mpc8xx_immr->im_cpm.cp_cptr, 0x00000180);
0078 }
0079 
0080 static void __init adder875_setup(void)
0081 {
0082     cpm_reset();
0083     init_ioports();
0084 }
0085 
0086 static int __init adder875_probe(void)
0087 {
0088     return of_machine_is_compatible("analogue-and-micro,adder875");
0089 }
0090 
0091 static const struct of_device_id of_bus_ids[] __initconst = {
0092     { .compatible = "simple-bus", },
0093     {},
0094 };
0095 
0096 static int __init declare_of_platform_devices(void)
0097 {
0098     of_platform_bus_probe(NULL, of_bus_ids, NULL);
0099     return 0;
0100 }
0101 machine_device_initcall(adder875, declare_of_platform_devices);
0102 
0103 define_machine(adder875) {
0104     .name = "Adder MPC875",
0105     .probe = adder875_probe,
0106     .setup_arch = adder875_setup,
0107     .init_IRQ = mpc8xx_pic_init,
0108     .get_irq = mpc8xx_get_irq,
0109     .restart = mpc8xx_restart,
0110     .calibrate_decr = generic_calibrate_decr,
0111     .progress = udbg_progress,
0112 };