From owner-p4-projects@FreeBSD.ORG Wed Mar 17 17:41:42 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id AF7D91065673; Wed, 17 Mar 2010 17:41:42 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5B907106566C for ; Wed, 17 Mar 2010 17:41:42 +0000 (UTC) (envelope-from raj@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 499B28FC1B for ; Wed, 17 Mar 2010 17:41:42 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o2HHfgmv060734 for ; Wed, 17 Mar 2010 17:41:42 GMT (envelope-from raj@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o2HHfgSx060732 for perforce@freebsd.org; Wed, 17 Mar 2010 17:41:42 GMT (envelope-from raj@freebsd.org) Date: Wed, 17 Mar 2010 17:41:42 GMT Message-Id: <201003171741.o2HHfgSx060732@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to raj@freebsd.org using -f From: Rafal Jaworowski To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 175767 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2010 17:41:42 -0000 http://p4web.freebsd.org/chv.cgi?CH=175767 Change 175767 by raj@raj_fdt on 2010/03/17 17:41:20 Clean up legacy #defines a bit. Affected files ... .. //depot/projects/fdt/sys/arm/mv/common.c#7 edit .. //depot/projects/fdt/sys/arm/mv/mvwin.h#3 edit .. //depot/projects/fdt/sys/arm/mv/orion/orion.c#3 edit Differences ... ==== //depot/projects/fdt/sys/arm/mv/common.c#7 (text+ko) ==== @@ -336,6 +336,17 @@ /* TODO add info on currently set endianess */ } +#define MV_USB0_BASE (FDT_IMMR_VA + usb0_base) +#define MV_CESA_BASE (FDT_IMMR_VA + cesa_base) +#define MV_ETH0_BASE (FDT_IMMR_VA + eth0_base) +#define MV_SATAHC_BASE (FDT_IMMR_VA + sata0_base) +#define MV_XOR_BASE (FDT_IMMR_VA + xor0_base) +#define MV_IDMA_BASE (FDT_IMMR_VA + idma0_base) + +/* XXX these are temporary and should be retrieved from the DT */ +#define MV_USB_AWR_BASE (MV_USB0_BASE + 0x320) +#define MV_ETH1_BASE (MV_ETH0_BASE + 0x4000) + int soc_decode_win(void) { @@ -394,25 +405,6 @@ return (0); } -/* - * XXX Redefine macros. This is needed to avoid destroying compatibility with - * macros to be removed in the future (but currently used elsewhere). This - * will not be neccessary when fdtbus will be functioning. - */ -#undef MV_USB0_BASE -#undef MV_CESA_BASE -#undef MV_ETH0_BASE -#undef MV_SATAHC_BASE -#undef MV_XOR_BASE -#undef MV_IDMA_BASE - -#define MV_USB0_BASE (FDT_IMMR_VA + usb0_base) -#define MV_CESA_BASE (FDT_IMMR_VA + cesa_base) -#define MV_ETH0_BASE (FDT_IMMR_VA + eth0_base) -#define MV_SATAHC_BASE (FDT_IMMR_VA + sata0_base) -#define MV_XOR_BASE (FDT_IMMR_VA + xor0_base) -#define MV_IDMA_BASE (FDT_IMMR_VA + idma0_base) - /************************************************************************** * Decode windows registers accessors **************************************************************************/ ==== //depot/projects/fdt/sys/arm/mv/mvwin.h#3 (text+ko) ==== @@ -87,31 +87,14 @@ #define MV_BASE MV_PHYS_BASE /* VA == PA mapping */ #define MV_DDR_CADR_BASE (MV_BASE + 0x1500) #define MV_MPP_BASE (MV_BASE + 0x10000) -#define MV_GPIO_BASE (MV_BASE + 0x10100) -#define MV_GPIO_SIZE 0x20 -#define MV_RTC_BASE (MV_BASE + 0x10300) -#define MV_RTC_SIZE 0x08 -#define MV_TWSI0_BASE (MV_BASE + 0x11000) -#define MV_TWSI1_BASE (MV_BASE + 0x11100) -#define MV_TWSI_SIZE 0x20 -#define MV_UART0_BASE (MV_BASE + 0x12000) -#define MV_UART1_BASE (MV_BASE + 0x12100) -#define MV_UART_SIZE 0x20 + #define MV_MBUS_BRIDGE_BASE (MV_BASE + 0x20000) #define MV_INTREGS_BASE (MV_MBUS_BRIDGE_BASE + 0x80) #define MV_CPU_CONTROL_BASE (MV_MBUS_BRIDGE_BASE + 0x100) -#define MV_IC_BASE (MV_MBUS_BRIDGE_BASE + 0x200) -#define MV_IC_SIZE 0x3C -#define MV_TIMERS_BASE (MV_MBUS_BRIDGE_BASE + 0x300) -#define MV_TIMERS_SIZE 0x30 + #define MV_PCI_BASE (MV_BASE + 0x30000) #define MV_PCI_SIZE 0x2000 -#if defined (SOC_MV_KIRKWOOD) -#define MV_CESA_BASE (MV_BASE + 0x30000) /* CESA,PCI don't coexist */ -#elif defined (SOC_MV_ORION) || defined(SOC_MV_DISCOVERY) -#define MV_CESA_BASE (MV_BASE + 0x90000) -#endif -#define MV_CESA_SIZE 0x10000 + #define MV_PCIE_BASE (MV_BASE + 0x40000) #define MV_PCIE_SIZE 0x2000 @@ -124,27 +107,7 @@ #define MV_PCIE12_BASE (MV_PCIE_BASE + 0x48000) #define MV_PCIE13_BASE (MV_PCIE_BASE + 0x4C000) -#define MV_USB0_BASE (MV_BASE + 0x50000) -#define MV_USB1_BASE (MV_USB0_BASE + 0x1000) -#define MV_USB2_BASE (MV_USB0_BASE + 0x2000) -#define MV_USB_SIZE 0x1000 -#define MV_USB_AWR_BASE (MV_USB0_BASE + 0x320) -#define MV_IDMA_BASE (MV_BASE + 0x60000) -#define MV_IDMA_SIZE 0x1000 -#define MV_XOR_BASE (MV_BASE + 0x60000) -#define MV_XOR_SIZE 0x1000 -#define MV_ETH0_BASE (MV_BASE + 0x72000) -#define MV_ETH1_BASE (MV_BASE + 0x76000) -#define MV_ETH_SIZE 0x2000 -#if defined(SOC_MV_ORION) || defined(SOC_MV_KIRKWOOD) -#define MV_SATAHC_BASE (MV_BASE + 0x80000) -#define MV_SATAHC_SIZE 0x6000 -#elif defined(SOC_MV_DISCOVERY) -#define MV_SATAHC_BASE (MV_BASE + 0xA0000) -#define MV_SATAHC_SIZE 0x6000 -#endif - -#define MV_DEV_CS0_BASE MV_DEV_CS0_PHYS_BASE +#define MV_DEV_CS0_BASE MV_DEV_CS0_PHYS_BASE /* * Decode windows definitions and macros @@ -219,70 +182,70 @@ static __inline uint32_t \ pre ## _ ## reg ## _read(int i) \ { \ - return (bus_space_read_4(obio_tag, base, off(i))); \ + return (bus_space_read_4(fdtbus_bs_tag, base, off(i))); \ } #define WIN_REG_IDX_RD2(pre,reg,off,base) \ static __inline uint32_t \ pre ## _ ## reg ## _read(int i, int j) \ { \ - return (bus_space_read_4(obio_tag, base, off(i, j))); \ + return (bus_space_read_4(fdtbus_bs_tag, base, off(i, j))); \ } \ #define WIN_REG_BASE_IDX_RD(pre,reg,off) \ static __inline uint32_t \ pre ## _ ## reg ## _read(uint32_t base, int i) \ { \ - return (bus_space_read_4(obio_tag, base, off(i))); \ + return (bus_space_read_4(fdtbus_bs_tag, base, off(i))); \ } #define WIN_REG_IDX_WR(pre,reg,off,base) \ static __inline void \ pre ## _ ## reg ## _write(int i, uint32_t val) \ { \ - bus_space_write_4(obio_tag, base, off(i), val); \ + bus_space_write_4(fdtbus_bs_tag, base, off(i), val); \ } #define WIN_REG_IDX_WR2(pre,reg,off,base) \ static __inline void \ pre ## _ ## reg ## _write(int i, int j, uint32_t val) \ { \ - bus_space_write_4(obio_tag, base, off(i, j), val); \ + bus_space_write_4(fdtbus_bs_tag, base, off(i, j), val); \ } #define WIN_REG_BASE_IDX_WR(pre,reg,off) \ static __inline void \ pre ## _ ## reg ## _write(uint32_t base, int i, uint32_t val) \ { \ - bus_space_write_4(obio_tag, base, off(i), val); \ + bus_space_write_4(fdtbus_bs_tag, base, off(i), val); \ } #define WIN_REG_RD(pre,reg,off,base) \ static __inline uint32_t \ pre ## _ ## reg ## _read(void) \ { \ - return (bus_space_read_4(obio_tag, base, off)); \ + return (bus_space_read_4(fdtbus_bs_tag, base, off)); \ } #define WIN_REG_BASE_RD(pre,reg,off) \ static __inline uint32_t \ pre ## _ ## reg ## _read(uint32_t base) \ { \ - return (bus_space_read_4(obio_tag, base, off)); \ + return (bus_space_read_4(fdtbus_bs_tag, base, off)); \ } #define WIN_REG_WR(pre,reg,off,base) \ static __inline void \ pre ## _ ## reg ## _write(uint32_t val) \ { \ - bus_space_write_4(obio_tag, base, off, val); \ + bus_space_write_4(fdtbus_bs_tag, base, off, val); \ } #define WIN_REG_BASE_WR(pre,reg,off) \ static __inline void \ pre ## _ ## reg ## _write(uint32_t base, uint32_t val) \ { \ - bus_space_write_4(obio_tag, base, off, val); \ + bus_space_write_4(fdtbus_bs_tag, base, off, val); \ } #endif /* _MVWIN_H_ */ ==== //depot/projects/fdt/sys/arm/mv/orion/orion.c#3 (text+ko) ==== @@ -37,6 +37,7 @@ #include #include +#include #include #include @@ -112,7 +113,8 @@ * On Orion TCLK is can be configured to 150 MHz or 166 MHz. * Current setting is read from Sample At Reset register. */ - sar = bus_space_read_4(obio_tag, MV_MPP_BASE, SAMPLE_AT_RESET); + /* XXX MPP addr should be retrieved from the DT */ + sar = bus_space_read_4(fdtbus_bs_tag, MV_MPP_BASE, SAMPLE_AT_RESET); sar = (sar & TCLK_MASK) >> TCLK_SHIFT; switch (sar) { case 1: