18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only 28c2ecf20Sopenharmony_ci/* Analogue & Micro Adder MPC875 board support 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Author: Scott Wood <scottwood@freescale.com> 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * Copyright (c) 2007 Freescale Semiconductor, Inc. 78c2ecf20Sopenharmony_ci */ 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#include <linux/init.h> 108c2ecf20Sopenharmony_ci#include <linux/fs_enet_pd.h> 118c2ecf20Sopenharmony_ci#include <linux/of_platform.h> 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#include <asm/time.h> 148c2ecf20Sopenharmony_ci#include <asm/machdep.h> 158c2ecf20Sopenharmony_ci#include <asm/cpm1.h> 168c2ecf20Sopenharmony_ci#include <asm/fs_pd.h> 178c2ecf20Sopenharmony_ci#include <asm/udbg.h> 188c2ecf20Sopenharmony_ci#include <asm/prom.h> 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci#include "mpc8xx.h" 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_cistruct cpm_pin { 238c2ecf20Sopenharmony_ci int port, pin, flags; 248c2ecf20Sopenharmony_ci}; 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_cistatic __initdata struct cpm_pin adder875_pins[] = { 278c2ecf20Sopenharmony_ci /* SMC1 */ 288c2ecf20Sopenharmony_ci {CPM_PORTB, 24, CPM_PIN_INPUT}, /* RX */ 298c2ecf20Sopenharmony_ci {CPM_PORTB, 25, CPM_PIN_INPUT | CPM_PIN_SECONDARY}, /* TX */ 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci /* MII1 */ 328c2ecf20Sopenharmony_ci {CPM_PORTA, 0, CPM_PIN_INPUT}, 338c2ecf20Sopenharmony_ci {CPM_PORTA, 1, CPM_PIN_INPUT}, 348c2ecf20Sopenharmony_ci {CPM_PORTA, 2, CPM_PIN_INPUT}, 358c2ecf20Sopenharmony_ci {CPM_PORTA, 3, CPM_PIN_INPUT}, 368c2ecf20Sopenharmony_ci {CPM_PORTA, 4, CPM_PIN_OUTPUT}, 378c2ecf20Sopenharmony_ci {CPM_PORTA, 10, CPM_PIN_OUTPUT}, 388c2ecf20Sopenharmony_ci {CPM_PORTA, 11, CPM_PIN_OUTPUT}, 398c2ecf20Sopenharmony_ci {CPM_PORTB, 19, CPM_PIN_INPUT}, 408c2ecf20Sopenharmony_ci {CPM_PORTB, 31, CPM_PIN_INPUT}, 418c2ecf20Sopenharmony_ci {CPM_PORTC, 12, CPM_PIN_INPUT}, 428c2ecf20Sopenharmony_ci {CPM_PORTC, 13, CPM_PIN_INPUT}, 438c2ecf20Sopenharmony_ci {CPM_PORTE, 30, CPM_PIN_OUTPUT}, 448c2ecf20Sopenharmony_ci {CPM_PORTE, 31, CPM_PIN_OUTPUT}, 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci /* MII2 */ 478c2ecf20Sopenharmony_ci {CPM_PORTE, 14, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY}, 488c2ecf20Sopenharmony_ci {CPM_PORTE, 15, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY}, 498c2ecf20Sopenharmony_ci {CPM_PORTE, 16, CPM_PIN_OUTPUT}, 508c2ecf20Sopenharmony_ci {CPM_PORTE, 17, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY}, 518c2ecf20Sopenharmony_ci {CPM_PORTE, 18, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY}, 528c2ecf20Sopenharmony_ci {CPM_PORTE, 19, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY}, 538c2ecf20Sopenharmony_ci {CPM_PORTE, 20, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY}, 548c2ecf20Sopenharmony_ci {CPM_PORTE, 21, CPM_PIN_OUTPUT}, 558c2ecf20Sopenharmony_ci {CPM_PORTE, 22, CPM_PIN_OUTPUT}, 568c2ecf20Sopenharmony_ci {CPM_PORTE, 23, CPM_PIN_OUTPUT}, 578c2ecf20Sopenharmony_ci {CPM_PORTE, 24, CPM_PIN_OUTPUT}, 588c2ecf20Sopenharmony_ci {CPM_PORTE, 25, CPM_PIN_OUTPUT}, 598c2ecf20Sopenharmony_ci {CPM_PORTE, 26, CPM_PIN_OUTPUT}, 608c2ecf20Sopenharmony_ci {CPM_PORTE, 27, CPM_PIN_OUTPUT}, 618c2ecf20Sopenharmony_ci {CPM_PORTE, 28, CPM_PIN_OUTPUT}, 628c2ecf20Sopenharmony_ci {CPM_PORTE, 29, CPM_PIN_OUTPUT}, 638c2ecf20Sopenharmony_ci}; 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_cistatic void __init init_ioports(void) 668c2ecf20Sopenharmony_ci{ 678c2ecf20Sopenharmony_ci int i; 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci for (i = 0; i < ARRAY_SIZE(adder875_pins); i++) { 708c2ecf20Sopenharmony_ci const struct cpm_pin *pin = &adder875_pins[i]; 718c2ecf20Sopenharmony_ci cpm1_set_pin(pin->port, pin->pin, pin->flags); 728c2ecf20Sopenharmony_ci } 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci cpm1_clk_setup(CPM_CLK_SMC1, CPM_BRG1, CPM_CLK_RTX); 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ci /* Set FEC1 and FEC2 to MII mode */ 778c2ecf20Sopenharmony_ci clrbits32(&mpc8xx_immr->im_cpm.cp_cptr, 0x00000180); 788c2ecf20Sopenharmony_ci} 798c2ecf20Sopenharmony_ci 808c2ecf20Sopenharmony_cistatic void __init adder875_setup(void) 818c2ecf20Sopenharmony_ci{ 828c2ecf20Sopenharmony_ci cpm_reset(); 838c2ecf20Sopenharmony_ci init_ioports(); 848c2ecf20Sopenharmony_ci} 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_cistatic int __init adder875_probe(void) 878c2ecf20Sopenharmony_ci{ 888c2ecf20Sopenharmony_ci return of_machine_is_compatible("analogue-and-micro,adder875"); 898c2ecf20Sopenharmony_ci} 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_cistatic const struct of_device_id of_bus_ids[] __initconst = { 928c2ecf20Sopenharmony_ci { .compatible = "simple-bus", }, 938c2ecf20Sopenharmony_ci {}, 948c2ecf20Sopenharmony_ci}; 958c2ecf20Sopenharmony_ci 968c2ecf20Sopenharmony_cistatic int __init declare_of_platform_devices(void) 978c2ecf20Sopenharmony_ci{ 988c2ecf20Sopenharmony_ci of_platform_bus_probe(NULL, of_bus_ids, NULL); 998c2ecf20Sopenharmony_ci return 0; 1008c2ecf20Sopenharmony_ci} 1018c2ecf20Sopenharmony_cimachine_device_initcall(adder875, declare_of_platform_devices); 1028c2ecf20Sopenharmony_ci 1038c2ecf20Sopenharmony_cidefine_machine(adder875) { 1048c2ecf20Sopenharmony_ci .name = "Adder MPC875", 1058c2ecf20Sopenharmony_ci .probe = adder875_probe, 1068c2ecf20Sopenharmony_ci .setup_arch = adder875_setup, 1078c2ecf20Sopenharmony_ci .init_IRQ = mpc8xx_pics_init, 1088c2ecf20Sopenharmony_ci .get_irq = mpc8xx_get_irq, 1098c2ecf20Sopenharmony_ci .restart = mpc8xx_restart, 1108c2ecf20Sopenharmony_ci .calibrate_decr = generic_calibrate_decr, 1118c2ecf20Sopenharmony_ci .progress = udbg_progress, 1128c2ecf20Sopenharmony_ci}; 113