summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2013-01-11 03:19:02 +0000
committerStefano Babic <sbabic@denx.de>2013-01-21 12:05:19 +0100
commit14e26bcfa700b507a805eb30c72e3b6a1ba19d7f (patch)
tree07b2611205bc7414a74b4cb0c7650a7c4853e13a /arch
parent59b6defa2b2db1b51f772e8ef6af2617463c8f80 (diff)
downloadu-boot-imx-14e26bcfa700b507a805eb30c72e3b6a1ba19d7f.zip
u-boot-imx-14e26bcfa700b507a805eb30c72e3b6a1ba19d7f.tar.gz
u-boot-imx-14e26bcfa700b507a805eb30c72e3b6a1ba19d7f.tar.bz2
mxs: ssp: Pull out the SSP bus to regs conversion
Create function which converts SSP bus number to SSP register pointer. This functionality is reimplemented multiple times in the code, thus make one common implementation. Moreover, make it a switch(), since the SSP ports are not mapped in such nice linear fashion on MX23, therefore having it a switch will simplify things there. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Andy Fleming <afleming@freescale.com> Cc: Fabio Estevam <fabio.estevam@freescale.com> Cc: Stefano Babic <sbabic@denx.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/cpu/arm926ejs/mxs/clock.c2
-rw-r--r--arch/arm/include/asm/arch-mxs/regs-ssp.h16
2 files changed, 17 insertions, 1 deletions
diff --git a/arch/arm/cpu/arm926ejs/mxs/clock.c b/arch/arm/cpu/arm926ejs/mxs/clock.c
index 4ff19c3..5d6e12a 100644
--- a/arch/arm/cpu/arm926ejs/mxs/clock.c
+++ b/arch/arm/cpu/arm926ejs/mxs/clock.c
@@ -278,7 +278,7 @@ void mx28_set_ssp_busclock(unsigned int bus, uint32_t freq)
uint32_t reg;
uint32_t divide, rate, tgtclk;
- ssp_regs = (struct mxs_ssp_regs *)(MXS_SSP0_BASE + (bus * 0x2000));
+ ssp_regs = mxs_ssp_regs_by_bus(bus);
/*
* SSP bit rate = SSPCLK / (CLOCK_DIVIDE * (1 + CLOCK_RATE)),
diff --git a/arch/arm/include/asm/arch-mxs/regs-ssp.h b/arch/arm/include/asm/arch-mxs/regs-ssp.h
index cf52a28..4a75029 100644
--- a/arch/arm/include/asm/arch-mxs/regs-ssp.h
+++ b/arch/arm/include/asm/arch-mxs/regs-ssp.h
@@ -50,6 +50,22 @@ struct mxs_ssp_regs {
mxs_reg_32(hw_ssp_debug)
mxs_reg_32(hw_ssp_version)
};
+
+static inline struct mxs_ssp_regs *mxs_ssp_regs_by_bus(unsigned int port)
+{
+ switch (port) {
+ case 0:
+ return (struct mxs_ssp_regs *)MXS_SSP0_BASE;
+ case 1:
+ return (struct mxs_ssp_regs *)MXS_SSP1_BASE;
+ case 2:
+ return (struct mxs_ssp_regs *)MXS_SSP2_BASE;
+ case 3:
+ return (struct mxs_ssp_regs *)MXS_SSP3_BASE;
+ default:
+ return NULL;
+ }
+}
#endif
#define SSP_CTRL0_SFTRST (1 << 31)