/*1* Copyright (C) 2000,2001,2004 Broadcom Corporation2*3* This program is free software; you can redistribute it and/or4* modify it under the terms of the GNU General Public License5* as published by the Free Software Foundation; either version 26* of the License, or (at your option) any later version.7*8* This program is distributed in the hope that it will be useful,9* but WITHOUT ANY WARRANTY; without even the implied warranty of10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the11* GNU General Public License for more details.12*13* You should have received a copy of the GNU General Public License14* along with this program; if not, write to the Free Software15* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.16*/17#include <linux/clocksource.h>1819#include <asm/addrspace.h>20#include <asm/io.h>21#include <asm/time.h>2223#include <asm/sibyte/bcm1480_regs.h>24#include <asm/sibyte/sb1250_regs.h>25#include <asm/sibyte/bcm1480_int.h>26#include <asm/sibyte/bcm1480_scd.h>2728#include <asm/sibyte/sb1250.h>2930static cycle_t bcm1480_hpt_read(struct clocksource *cs)31{32return (cycle_t) __raw_readq(IOADDR(A_SCD_ZBBUS_CYCLE_COUNT));33}3435struct clocksource bcm1480_clocksource = {36.name = "zbbus-cycles",37.rating = 200,38.read = bcm1480_hpt_read,39.mask = CLOCKSOURCE_MASK(64),40.flags = CLOCK_SOURCE_IS_CONTINUOUS,41};4243void __init sb1480_clocksource_init(void)44{45struct clocksource *cs = &bcm1480_clocksource;46unsigned int plldiv;47unsigned long zbbus;4849plldiv = G_BCM1480_SYS_PLL_DIV(__raw_readq(IOADDR(A_SCD_SYSTEM_CFG)));50zbbus = ((plldiv >> 1) * 50000000) + ((plldiv & 1) * 25000000);51clocksource_register_hz(cs, zbbus);52}535455