On Tue, Sep 20, 2022 at 02:04:14PM +0000, Miod Vallat wrote:
> I recently installed OpenBSD to a PandaBoard (the original, not
> PandaBoard ES) and noticed that the clock was very quickly getting
> behind, with ntpd unable to cope.
> 
> The following extremely crude diff fixes it, but probably at the expense
> of breaking other omap systems. Is there a better way to figure out what
> is the real system clock frequency?

Cortex-A9 MPCore Technical Reference Manual
ARM DDI 0407I

"CLK
This is the main clock of the Cortex-A9 processor.
All Cortex-A9 processors in the Cortex-A9 MPCore processor and the SCU
are clocked with a distributed version of CLK.

PERIPHCLK
The Interrupt Controller, global timer, private timers, and watchdogs
are clocked with PERIPHCLK.
PERIPHCLK must be synchronous with CLK, and the PERIPHCLK clock
period, N, must be configured as a multiple of the CLK clock period.
This multiple N must be equal to, or greater than two."

OMAP4430 Multimedia Device Silicon Revision 2.x
Technical Reference Manual, Version AG
pg 1088:

     ref clock         MPU_DPLL_CLK                ARM_FCLK
PRCM --------->MPU DPLL------------>clock generator-------->Cortex-A9

So the device tree clock to use is mpu_periphclk?

Getting data from PRCM?

> 
> Index: sys/arch/armv7/omap/omapid.c
> ===================================================================
> RCS file: /OpenBSD/src/sys/arch/armv7/omap/omapid.c,v
> retrieving revision 1.5
> diff -u -p -u -p -r1.5 omapid.c
> --- sys/arch/armv7/omap/omapid.c      24 Oct 2021 17:52:27 -0000      1.5
> +++ sys/arch/armv7/omap/omapid.c      20 Sep 2022 13:54:01 -0000
> @@ -83,9 +83,12 @@ omapid_attach(struct device *parent, str
>               rev = bus_space_read_4(sc->sc_iot, sc->sc_ioh, O4_ID_CODE);
>               switch ((rev >> 12) & 0xffff) {
>               case 0xB852:
> -             case 0xB95C:
>                       board = "omap4430";
>                       newclockrate = 400 * 1000 * 1000;
> +                     break;
> +             case 0xB95C:
> +                     board = "omap4430";
> +                     newclockrate = 300 * 1000 * 1000;
>                       break;
>               case 0xB94E:
>                       board = "omap4460";
> 
> 
> 
> OpenBSD 7.2 (GENERIC) #11: Tue Sep 20 13:18:51 GMT 2022
>     m...@enfer.gentiane.org:/usr/src/sys/arch/armv7/compile/GENERIC
> real mem  = 1021243392 (973MB)
> avail mem = 992374784 (946MB)
> random: boothowto does not indicate good seed
> mainbus0 at root: TI OMAP4 PandaBoard
> cpu0 at mainbus0 mpidr 0: ARM Cortex-A9 r1p2
> cpu0: 32KB 32b/line 4-way L1 VIPT I-cache, 32KB 32b/line 4-way L1 D-cache
> cortex0 at mainbus0
> amptimer0 at cortex0: 396000 kHz
> armliicc0 at cortex0: rtl 4 waymask: 0x0000000f
> omap0 at mainbus0
> omapid0 at omap0: omap4430
> amptimer0: adjusting clock: new rate 300000 kHz
> prcm0 at omap0 rev 0.0
> ampintc0 at mainbus0 nirq 160, ncpu 2: "interrupt-controller"
> omwugen0 at mainbus0
> simplebus0 at mainbus0: "ocp"
> omsysc0 at simplebus0: "target-module"
> omsysc1 at simplebus0: "target-module"
> omsysc2 at simplebus0: "target-module"
> omsysc3 at simplebus0: "target-module"
> omsysc4 at simplebus0: "target-module"
> omsysc5 at simplebus0: "target-module"
> omsysc6 at simplebus0: "target-module"
> simplebus1 at simplebus0: "l4"
> simplebus2 at simplebus1: "cm1"
> omcm0 at simplebus2: "mpuss_cm"
> omclock0 at omcm0: "clk"
> omcm1 at simplebus2: "tesla_cm"
> omclock1 at omcm1: "clk"
> omcm2 at simplebus2: "abe_cm"
> omclock2 at omcm2: "clk"
> simplebus3 at simplebus1: "cm2"
> omcm3 at simplebus3: "l4_ao_cm"
> omclock3 at omcm3: "clk"
> omcm4 at simplebus3: "l3_1_cm"
> omclock4 at omcm4: "clk"
> omcm5 at simplebus3: "l3_2_cm"
> omclock5 at omcm5: "clk"
> omcm6 at simplebus3: "ducati_cm"
> omclock6 at omcm6: "clk"
> omcm7 at simplebus3: "l3_dma_cm"
> omclock7 at omcm7: "clk"
> omcm8 at simplebus3: "l3_emif_cm"
> omclock8 at omcm8: "clk"
> omcm9 at simplebus3: "d2d_cm"
> omclock9 at omcm9: "clk"
> omcm10 at simplebus3: "l4_cfg_cm"
> omclock10 at omcm10: "clk"
> omcm11 at simplebus3: "l3_instr_cm"
> omclock11 at omcm11: "clk"
> omcm12 at simplebus3: "ivahd_cm"
> omclock12 at omcm12: "clk"
> omcm13 at simplebus3: "iss_cm"
> omclock13 at omcm13: "clk"
> omcm14 at simplebus3: "l3_dss_cm"
> omclock14 at omcm14: "clk"
> omcm15 at simplebus3: "l3_gfx_cm"
> omclock15 at omcm15: "clk"
> omcm16 at simplebus3: "l3_init_cm"
> omclock16 at omcm16: "clk"
> omcm17 at simplebus3: "l4_per_cm"
> omclock17 at omcm17: "clk"
> simplebus4 at simplebus1: "scm"
> syscon0 at simplebus4: "scm_conf"
> simplebus5 at simplebus1: "scm"
> syscon1 at simplebus5: "omap4_padconf_global"
> pinctrl0 at simplebus5
> simplebus6 at simplebus1: "l4"
> "counter" at simplebus6 not configured
> "prm" at simplebus6 not configured
> "scrm" at simplebus6 not configured
> "scm" at simplebus6 not configured
> simplebus7 at simplebus6: "padconf"
> pinctrl1 at simplebus7
> "ocmcram" at simplebus0 not configured
> "dma-controller" at simplebus0 not configured
> omgpio0 at simplebus0: rev 0.1
> gpio0 at omgpio0: 32 pins
> omgpio1 at simplebus0: rev 0.1
> gpio1 at omgpio1: 32 pins
> omgpio2 at simplebus0: rev 0.1
> gpio2 at omgpio2: 32 pins
> omgpio3 at simplebus0: rev 0.1
> gpio3 at omgpio3: 32 pins
> omgpio4 at simplebus0: rev 0.1
> gpio4 at omgpio4: 32 pins
> omgpio5 at simplebus0: rev 0.1
> gpio5 at omgpio5: 32 pins
> "gpmc" at simplebus0 not configured
> com0 at simplebus0: ti16750, 64 byte fifo
> com0: probed fifo depth: 0 bytes
> com1 at simplebus0: ti16750, 64 byte fifo
> com1: probed fifo depth: 0 bytes
> com2 at simplebus0: ti16750, 64 byte fifo
> com2: console
> com3 at simplebus0: ti16750, 64 byte fifo
> com3: probed fifo depth: 0 bytes
> omsysc7 at simplebus0: "target-module"
> "smartreflex" at omsysc7 not configured
> omsysc8 at simplebus0: "target-module"
> "smartreflex" at omsysc8 not configured
> omsysc9 at simplebus0: "target-module"
> "smartreflex" at omsysc9 not configured
> "spinlock" at simplebus0 not configured
> tiiic0 at simplebus0 rev 0.10
> iic0 at tiiic0
> "ti,twl6030" at iic0 addr 0x48 not configured
> "ti,twl6040" at iic0 addr 0x4b not configured
> tiiic1 at simplebus0 rev 0.10
> iic1 at tiiic1
> tiiic2 at simplebus0 rev 0.10
> iic2 at tiiic2
> "ti,eeprom" at iic2 addr 0x50 not configured
> tiiic3 at simplebus0 rev 0.10
> iic3 at tiiic3
> "spi" at simplebus0 not configured
> "spi" at simplebus0 not configured
> "1w" at simplebus0 not configured
> "spi" at simplebus0 not configured
> "spi" at simplebus0 not configured
> ommmc0 at simplebus0
> sdmmc0 at ommmc0: 8-bit
> ommmc1 at simplebus0
> sdmmc1 at ommmc1: 1-bit
> "hsi" at simplebus0 not configured
> "mmu" at simplebus0 not configured
> "mmu" at simplebus0 not configured
> omdog0 at simplebus0 rev 0.0
> omdog1 at simplebus0 rev 0.0
> "mcpdm" at simplebus0 not configured
> "mcbsp" at simplebus0 not configured
> "keypad" at simplebus0 not configured
> "dmm" at simplebus0 not configured
> "emif" at simplebus0 not configured
> "emif" at simplebus0 not configured
> "ocp2scp" at simplebus0 not configured
> "mailbox" at simplebus0 not configured
> "timer" at simplebus0 not configured
> "timer" at simplebus0 not configured
> "timer" at simplebus0 not configured
> "timer" at simplebus0 not configured
> "timer" at simplebus0 not configured
> "timer" at simplebus0 not configured
> "timer" at simplebus0 not configured
> "timer" at simplebus0 not configured
> "timer" at simplebus0 not configured
> "timer" at simplebus0 not configured
> "timer" at simplebus0 not configured
> "usbhstll" at simplebus0 not configured
> omehci0 at simplebus0
> usb0 at omehci0: USB revision 2.0
> uhub0 at usb0 configuration 1 interface 0 "TI OMAP EHCI root hub" rev 
> 2.00/1.00 addr 1
> "control-phy" at simplebus0 not configured
> "control-phy" at simplebus0 not configured
> "usb_otg_hs" at simplebus0 not configured
> "aes" at simplebus0 not configured
> "aes" at simplebus0 not configured
> "des" at simplebus0 not configured
> "sham" at simplebus0 not configured
> "regulator-abb-mpu" at simplebus0 not configured
> "dss" at simplebus0 not configured
> "bandgap" at simplebus0 not configured
> sdmmc1: can't supply clock
> sdmmc1: can't enable card
> scsibus0 at sdmmc0: 2 targets, initiator 0
> sd0 at scsibus0 targ 1 lun 0: <SD/MMC, SU08G, 0080> removable
> sd0: 7580MB, 512 bytes/sector, 15523840 sectors
> uhub1 at uhub0 port 1 configuration 1 interface 0 "Standard Microsystems 
> product 0x9514" rev 2.00/1.00 addr 2
> smsc0 at uhub1 port 1 configuration 1 interface 0 "Standard Microsystems 
> SMSC9512/14" rev 2.00/1.00 addr 3
> smsc0: address 02:04:01:eb:19:20
> ukphy0 at smsc0 phy 1: Generic IEEE 802.3u media interface, rev. 3: OUI 
> 0x0001f0, model 0x000c
> umass0 at uhub1 port 3 configuration 1 interface 0 "Generic Externa" rev 
> 2.10/0.56 addr 4
> umass0: using SCSI over Bulk-Only
> scsibus1 at umass0: 2 targets, initiator 0
> sd1 at scsibus1 targ 1 lun 0: <Generic, Externa, 0056> 
> serial.88887777222222220138
> sd1: 228936MB, 512 bytes/sector, 468862127 sectors
> vscsi0 at root
> scsibus2 at vscsi0: 256 targets
> softraid0 at root
> scsibus3 at softraid0: 256 targets
> bootfile: sd0a:/bsd
> boot device: sd0
> root device (default sd0a): sd1a
> swap device (default sd1b): 
> root on sd1a swap on sd1b dump on sd1b
> WARNING: CHECK AND RESET THE DATE!
> 
> 

Reply via email to