9
0
Fork 0

Merge branch 'for-next/imx-dt' into for-next/imx

This commit is contained in:
Sascha Hauer 2012-10-17 08:48:54 +02:00
commit f393758c53
24 changed files with 273 additions and 102 deletions

View File

@ -236,7 +236,7 @@ static int mx28_evk_devices_init(void)
imx_enable_enetclk();
mx28_evk_fec_reset();
add_generic_device("fec_imx", 0, NULL, IMX_FEC0_BASE, 0x4000,
add_generic_device("imx28-fec", 0, NULL, IMX_FEC0_BASE, 0x4000,
IORESOURCE_MEM, &fec_info);
return 0;

View File

@ -393,7 +393,7 @@ void base_board_init(void)
tx28_get_ethaddr();
imx_enable_enetclk();
add_generic_device("fec_imx", 0, NULL, IMX_FEC0_BASE, 0x4000,
add_generic_device("imx28-fec", 0, NULL, IMX_FEC0_BASE, 0x4000,
IORESOURCE_MEM, &fec_info);
ret = register_persistent_environment();

View File

@ -96,9 +96,18 @@ static int imx1_ccm_probe(struct device_d *dev)
return 0;
}
static __maybe_unused struct of_device_id imx1_ccm_dt_ids[] = {
{
.compatible = "fsl,imx1-ccm",
}, {
/* sentinel */
}
};
static struct driver_d imx1_ccm_driver = {
.probe = imx1_ccm_probe,
.name = "imx1-ccm",
.of_compatible = DRV_OF_COMPAT(imx1_ccm_dt_ids),
};
static int imx1_ccm_init(void)

View File

@ -107,9 +107,18 @@ static int imx21_ccm_probe(struct device_d *dev)
return 0;
}
static __maybe_unused struct of_device_id imx21_ccm_dt_ids[] = {
{
.compatible = "fsl,imx21-ccm",
}, {
/* sentinel */
}
};
static struct driver_d imx21_ccm_driver = {
.probe = imx21_ccm_probe,
.name = "imx21-ccm",
.of_compatible = DRV_OF_COMPAT(imx21_ccm_dt_ids),
};
static int imx21_ccm_init(void)

View File

@ -152,9 +152,18 @@ static int imx25_ccm_probe(struct device_d *dev)
return 0;
}
static __maybe_unused struct of_device_id imx25_ccm_dt_ids[] = {
{
.compatible = "fsl,imx25-ccm",
}, {
/* sentinel */
}
};
static struct driver_d imx25_ccm_driver = {
.probe = imx25_ccm_probe,
.name = "imx25-ccm",
.of_compatible = DRV_OF_COMPAT(imx25_ccm_dt_ids),
};
static int imx25_ccm_init(void)

View File

@ -142,9 +142,18 @@ static int imx27_ccm_probe(struct device_d *dev)
return 0;
}
static __maybe_unused struct of_device_id imx27_ccm_dt_ids[] = {
{
.compatible = "fsl,imx27-ccm",
}, {
/* sentinel */
}
};
static struct driver_d imx27_ccm_driver = {
.probe = imx27_ccm_probe,
.name = "imx27-ccm",
.of_compatible = DRV_OF_COMPAT(imx27_ccm_dt_ids),
};
static int imx27_ccm_init(void)

View File

@ -121,9 +121,18 @@ static int imx31_ccm_probe(struct device_d *dev)
return 0;
}
static __maybe_unused struct of_device_id imx31_ccm_dt_ids[] = {
{
.compatible = "fsl,imx31-ccm",
}, {
/* sentinel */
}
};
static struct driver_d imx31_ccm_driver = {
.probe = imx31_ccm_probe,
.name = "imx31-ccm",
.of_compatible = DRV_OF_COMPAT(imx31_ccm_dt_ids),
};
static int imx31_ccm_init(void)

View File

@ -174,9 +174,18 @@ static int imx35_ccm_probe(struct device_d *dev)
return 0;
}
static __maybe_unused struct of_device_id imx35_ccm_dt_ids[] = {
{
.compatible = "fsl,imx35-ccm",
}, {
/* sentinel */
}
};
static struct driver_d imx35_ccm_driver = {
.probe = imx35_ccm_probe,
.name = "imx35-ccm",
.of_compatible = DRV_OF_COMPAT(imx35_ccm_dt_ids),
};
static int imx35_ccm_init(void)

View File

@ -233,9 +233,18 @@ static int imx51_ccm_probe(struct device_d *dev)
return 0;
}
static __maybe_unused struct of_device_id imx51_ccm_dt_ids[] = {
{
.compatible = "fsl,imx51-ccm",
}, {
/* sentinel */
}
};
static struct driver_d imx51_ccm_driver = {
.probe = imx51_ccm_probe,
.name = "imx51-ccm",
.of_compatible = DRV_OF_COMPAT(imx51_ccm_dt_ids),
};
static int imx51_ccm_init(void)
@ -285,9 +294,18 @@ static int imx53_ccm_probe(struct device_d *dev)
return 0;
}
static __maybe_unused struct of_device_id imx53_ccm_dt_ids[] = {
{
.compatible = "fsl,imx53-ccm",
}, {
/* sentinel */
}
};
static struct driver_d imx53_ccm_driver = {
.probe = imx53_ccm_probe,
.name = "imx53-ccm",
.of_compatible = DRV_OF_COMPAT(imx53_ccm_dt_ids),
};
static int imx53_ccm_init(void)

View File

@ -294,9 +294,18 @@ static int imx6_ccm_probe(struct device_d *dev)
return 0;
}
static __maybe_unused struct of_device_id imx6_ccm_dt_ids[] = {
{
.compatible = "fsl,imx6-ccm",
}, {
/* sentinel */
}
};
static struct driver_d imx6_ccm_driver = {
.probe = imx6_ccm_probe,
.name = "imx6-ccm",
.of_compatible = DRV_OF_COMPAT(imx6_ccm_dt_ids),
};
static int imx6_ccm_init(void)

View File

@ -8,9 +8,14 @@ static inline struct device_d *imx_add_device(char *name, int id, void *base, in
IORESOURCE_MEM, pdata);
}
struct device_d *imx_add_fec(void *base, struct fec_platform_data *pdata)
struct device_d *imx_add_fec_imx27(void *base, struct fec_platform_data *pdata)
{
return imx_add_device("fec_imx", -1, base, 0x1000, pdata);
return imx_add_device("imx27-fec", -1, base, 0x1000, pdata);
}
struct device_d *imx_add_fec_imx6(void *base, struct fec_platform_data *pdata)
{
return imx_add_device("imx6-fec", -1, base, 0x1000, pdata);
}
struct device_d *imx_add_spi(void *base, int id, struct spi_imx_master *pdata)
@ -23,9 +28,14 @@ struct device_d *imx_add_i2c(void *base, int id, struct i2c_platform_data *pdata
return imx_add_device("i2c-fsl", id, base, 0x1000, pdata);
}
struct device_d *imx_add_uart(void *base, int id)
struct device_d *imx_add_uart_imx1(void *base, int id)
{
return imx_add_device("imx_serial", id, base, 0x1000, NULL);
return imx_add_device("imx1-uart", id, base, 0x1000, NULL);
}
struct device_d *imx_add_uart_imx21(void *base, int id)
{
return imx_add_device("imx21-uart", id, base, 0x1000, NULL);
}
struct device_d *imx_add_nand(void *base, struct imx_nand_platform_data *pdata)

View File

@ -2,10 +2,10 @@
static inline struct device_d *imx1_add_uart0(void)
{
return imx_add_uart((void *)MX1_UART1_BASE_ADDR, 0);
return imx_add_uart_imx1((void *)MX1_UART1_BASE_ADDR, 0);
}
static inline struct device_d *imx1_add_uart1(void)
{
return imx_add_uart((void *)MX1_UART2_BASE_ADDR, 1);
return imx_add_uart_imx1((void *)MX1_UART2_BASE_ADDR, 1);
}

View File

@ -3,22 +3,22 @@
static inline struct device_d *imx21_add_uart0(void)
{
return imx_add_uart((void *)MX21_UART1_BASE_ADDR, 0);
return imx_add_uart_imx21((void *)MX21_UART1_BASE_ADDR, 0);
}
static inline struct device_d *imx21_add_uart1(void)
{
return imx_add_uart((void *)MX21_UART2_BASE_ADDR, 1);
return imx_add_uart_imx21((void *)MX21_UART2_BASE_ADDR, 1);
}
static inline struct device_d *imx21_add_uart2(void)
{
return imx_add_uart((void *)MX21_UART2_BASE_ADDR, 2);
return imx_add_uart_imx21((void *)MX21_UART2_BASE_ADDR, 2);
}
static inline struct device_d *imx21_add_uart3(void)
{
return imx_add_uart((void *)MX21_UART2_BASE_ADDR, 3);
return imx_add_uart_imx21((void *)MX21_UART2_BASE_ADDR, 3);
}
static inline struct device_d *imx21_add_nand(struct imx_nand_platform_data *pdata)

View File

@ -33,27 +33,27 @@ static inline struct device_d *imx25_add_spi2(struct spi_imx_master *pdata)
static inline struct device_d *imx25_add_uart0(void)
{
return imx_add_uart((void *)MX25_UART1_BASE_ADDR, 0);
return imx_add_uart_imx21((void *)MX25_UART1_BASE_ADDR, 0);
}
static inline struct device_d *imx25_add_uart1(void)
{
return imx_add_uart((void *)MX25_UART2_BASE_ADDR, 1);
return imx_add_uart_imx21((void *)MX25_UART2_BASE_ADDR, 1);
}
static inline struct device_d *imx25_add_uart2(void)
{
return imx_add_uart((void *)MX25_UART3_BASE_ADDR, 2);
return imx_add_uart_imx21((void *)MX25_UART3_BASE_ADDR, 2);
}
static inline struct device_d *imx25_add_uart3(void)
{
return imx_add_uart((void *)MX25_UART4_BASE_ADDR, 3);
return imx_add_uart_imx21((void *)MX25_UART4_BASE_ADDR, 3);
}
static inline struct device_d *imx25_add_uart4(void)
{
return imx_add_uart((void *)MX25_UART5_BASE_ADDR, 4);
return imx_add_uart_imx21((void *)MX25_UART5_BASE_ADDR, 4);
}
static inline struct device_d *imx25_add_nand(struct imx_nand_platform_data *pdata)
@ -68,7 +68,7 @@ static inline struct device_d *imx25_add_fb(struct imx_fb_platform_data *pdata)
static inline struct device_d *imx25_add_fec(struct fec_platform_data *pdata)
{
return imx_add_fec((void *)MX25_FEC_BASE_ADDR, pdata);
return imx_add_fec_imx27((void *)MX25_FEC_BASE_ADDR, pdata);
}
static inline struct device_d *imx25_add_mmc0(struct esdhc_platform_data *pdata)

View File

@ -23,22 +23,22 @@ static inline struct device_d *imx27_add_i2c1(struct i2c_platform_data *pdata)
static inline struct device_d *imx27_add_uart0(void)
{
return imx_add_uart((void *)MX27_UART1_BASE_ADDR, 0);
return imx_add_uart_imx21((void *)MX27_UART1_BASE_ADDR, 0);
}
static inline struct device_d *imx27_add_uart1(void)
{
return imx_add_uart((void *)MX27_UART2_BASE_ADDR, 1);
return imx_add_uart_imx21((void *)MX27_UART2_BASE_ADDR, 1);
}
static inline struct device_d *imx27_add_uart2(void)
{
return imx_add_uart((void *)MX27_UART3_BASE_ADDR, 2);
return imx_add_uart_imx21((void *)MX27_UART3_BASE_ADDR, 2);
}
static inline struct device_d *imx27_add_uart3(void)
{
return imx_add_uart((void *)MX27_UART4_BASE_ADDR, 3);
return imx_add_uart_imx21((void *)MX27_UART4_BASE_ADDR, 3);
}
static inline struct device_d *imx27_add_nand(struct imx_nand_platform_data *pdata)
@ -53,7 +53,7 @@ static inline struct device_d *imx27_add_fb(struct imx_fb_platform_data *pdata)
static inline struct device_d *imx27_add_fec(struct fec_platform_data *pdata)
{
return imx_add_fec((void *)MX27_FEC_BASE_ADDR, pdata);
return imx_add_fec_imx27((void *)MX27_FEC_BASE_ADDR, pdata);
}
static inline struct device_d *imx27_add_mmc0(void *pdata)

View File

@ -19,27 +19,27 @@ static inline struct device_d *imx31_add_spi2(struct spi_imx_master *pdata)
static inline struct device_d *imx31_add_uart0(void)
{
return imx_add_uart((void *)MX31_UART1_BASE_ADDR, 0);
return imx_add_uart_imx21((void *)MX31_UART1_BASE_ADDR, 0);
}
static inline struct device_d *imx31_add_uart1(void)
{
return imx_add_uart((void *)MX31_UART2_BASE_ADDR, 1);
return imx_add_uart_imx21((void *)MX31_UART2_BASE_ADDR, 1);
}
static inline struct device_d *imx31_add_uart2(void)
{
return imx_add_uart((void *)MX31_UART3_BASE_ADDR, 2);
return imx_add_uart_imx21((void *)MX31_UART3_BASE_ADDR, 2);
}
static inline struct device_d *imx31_add_uart3(void)
{
return imx_add_uart((void *)MX31_UART4_BASE_ADDR, 3);
return imx_add_uart_imx21((void *)MX31_UART4_BASE_ADDR, 3);
}
static inline struct device_d *imx31_add_uart4(void)
{
return imx_add_uart((void *)MX31_UART5_BASE_ADDR, 4);
return imx_add_uart_imx21((void *)MX31_UART5_BASE_ADDR, 4);
}
static inline struct device_d *imx31_add_nand(struct imx_nand_platform_data *pdata)

View File

@ -28,17 +28,17 @@ static inline struct device_d *imx35_add_spi(struct spi_imx_master *pdata)
static inline struct device_d *imx35_add_uart0(void)
{
return imx_add_uart((void *)MX35_UART1_BASE_ADDR, 0);
return imx_add_uart_imx21((void *)MX35_UART1_BASE_ADDR, 0);
}
static inline struct device_d *imx35_add_uart1(void)
{
return imx_add_uart((void *)MX35_UART2_BASE_ADDR, 1);
return imx_add_uart_imx21((void *)MX35_UART2_BASE_ADDR, 1);
}
static inline struct device_d *imx35_add_uart2(void)
{
return imx_add_uart((void *)MX35_UART3_BASE_ADDR, 2);
return imx_add_uart_imx21((void *)MX35_UART3_BASE_ADDR, 2);
}
static inline struct device_d *imx35_add_nand(struct imx_nand_platform_data *pdata)
@ -53,7 +53,7 @@ static inline struct device_d *imx35_add_fb(struct imx_ipu_fb_platform_data *pda
static inline struct device_d *imx35_add_fec(struct fec_platform_data *pdata)
{
return imx_add_fec((void *)MX35_FEC_BASE_ADDR, pdata);
return imx_add_fec_imx27((void *)MX35_FEC_BASE_ADDR, pdata);
}
static inline struct device_d *imx35_add_mmc0(struct esdhc_platform_data *pdata)

View File

@ -29,22 +29,22 @@ static inline struct device_d *imx51_add_i2c1(struct i2c_platform_data *pdata)
static inline struct device_d *imx51_add_uart0(void)
{
return imx_add_uart((void *)MX51_UART1_BASE_ADDR, 0);
return imx_add_uart_imx21((void *)MX51_UART1_BASE_ADDR, 0);
}
static inline struct device_d *imx51_add_uart1(void)
{
return imx_add_uart((void *)MX51_UART2_BASE_ADDR, 1);
return imx_add_uart_imx21((void *)MX51_UART2_BASE_ADDR, 1);
}
static inline struct device_d *imx51_add_uart2(void)
{
return imx_add_uart((void *)MX51_UART3_BASE_ADDR, 2);
return imx_add_uart_imx21((void *)MX51_UART3_BASE_ADDR, 2);
}
static inline struct device_d *imx51_add_fec(struct fec_platform_data *pdata)
{
return imx_add_fec((void *)MX51_MXC_FEC_BASE_ADDR, pdata);
return imx_add_fec_imx27((void *)MX51_MXC_FEC_BASE_ADDR, pdata);
}
static inline struct device_d *imx51_add_mmc0(struct esdhc_platform_data *pdata)

View File

@ -23,22 +23,22 @@ static inline struct device_d *imx53_add_i2c1(struct i2c_platform_data *pdata)
static inline struct device_d *imx53_add_uart0(void)
{
return imx_add_uart((void *)MX53_UART1_BASE_ADDR, 0);
return imx_add_uart_imx21((void *)MX53_UART1_BASE_ADDR, 0);
}
static inline struct device_d *imx53_add_uart1(void)
{
return imx_add_uart((void *)MX53_UART2_BASE_ADDR, 1);
return imx_add_uart_imx21((void *)MX53_UART2_BASE_ADDR, 1);
}
static inline struct device_d *imx53_add_uart2(void)
{
return imx_add_uart((void *)MX53_UART3_BASE_ADDR, 2);
return imx_add_uart_imx21((void *)MX53_UART3_BASE_ADDR, 2);
}
static inline struct device_d *imx53_add_fec(struct fec_platform_data *pdata)
{
return imx_add_fec((void *)MX53_FEC_BASE_ADDR, pdata);
return imx_add_fec_imx27((void *)MX53_FEC_BASE_ADDR, pdata);
}
static inline struct device_d *imx53_add_mmc0(struct esdhc_platform_data *pdata)

View File

@ -2,22 +2,22 @@
static inline struct device_d *imx6_add_uart0(void)
{
return imx_add_uart((void *)MX6_UART1_BASE_ADDR, 0);
return imx_add_uart_imx21((void *)MX6_UART1_BASE_ADDR, 0);
}
static inline struct device_d *imx6_add_uart1(void)
{
return imx_add_uart((void *)MX6_UART2_BASE_ADDR, 1);
return imx_add_uart_imx21((void *)MX6_UART2_BASE_ADDR, 1);
}
static inline struct device_d *imx6_add_uart2(void)
{
return imx_add_uart((void *)MX6_UART3_BASE_ADDR, 2);
return imx_add_uart_imx21((void *)MX6_UART3_BASE_ADDR, 2);
}
static inline struct device_d *imx6_add_uart3(void)
{
return imx_add_uart((void *)MX6_UART4_BASE_ADDR, 3);
return imx_add_uart_imx21((void *)MX6_UART4_BASE_ADDR, 3);
}
static inline struct device_d *imx6_add_mmc0(struct esdhc_platform_data *pdata)
@ -42,7 +42,7 @@ static inline struct device_d *imx6_add_mmc3(struct esdhc_platform_data *pdata)
static inline struct device_d *imx6_add_fec(struct fec_platform_data *pdata)
{
return imx_add_fec((void *)MX6_ENET_BASE_ADDR, pdata);
return imx_add_fec_imx6((void *)MX6_ENET_BASE_ADDR, pdata);
}
static inline struct device_d *imx6_add_spi0(struct spi_imx_master *pdata)

View File

@ -8,10 +8,12 @@
#include <mach/imx-ipu-fb.h>
#include <mach/esdhc.h>
struct device_d *imx_add_fec(void *base, struct fec_platform_data *pdata);
struct device_d *imx_add_fec_imx27(void *base, struct fec_platform_data *pdata);
struct device_d *imx_add_fec_imx6(void *base, struct fec_platform_data *pdata);
struct device_d *imx_add_spi(void *base, int id, struct spi_imx_master *pdata);
struct device_d *imx_add_i2c(void *base, int id, struct i2c_platform_data *pdata);
struct device_d *imx_add_uart(void *base, int id);
struct device_d *imx_add_uart_imx1(void *base, int id);
struct device_d *imx_add_uart_imx21(void *base, int id);
struct device_d *imx_add_nand(void *base, struct imx_nand_platform_data *pdata);
struct device_d *imx_add_fb(void *base, struct imx_fb_platform_data *pdata);
struct device_d *imx_add_ipufb(void *base, struct imx_ipu_fb_platform_data *pdata);

View File

@ -310,7 +310,7 @@ static int fec_init(struct eth_device *dev)
}
if (fec->xcv_type == RMII) {
if (cpu_is_mx28()) {
if (fec_is_imx28(fec)) {
rcntl |= FEC_R_CNTRL_RMII_MODE | FEC_R_CNTRL_FCE |
FEC_R_CNTRL_NO_LGTH_CHECK;
} else {
@ -340,7 +340,7 @@ static int fec_init(struct eth_device *dev)
xwmrk = 0x2;
/* set ENET tx at store and forward mode */
if (cpu_is_mx6())
if (fec_is_imx6(fec))
xwmrk |= 1 << 8;
writel(xwmrk, fec->regs + FEC_X_WMRK);
@ -407,7 +407,7 @@ static int fec_open(struct eth_device *edev)
ecr = FEC_ECNTRL_ETHER_EN;
/* Enable Swap to support little-endian device */
if (cpu_is_mx6())
if (fec_is_imx6(fec))
ecr |= 0x100;
writel(ecr, fec->regs + FEC_ECNTRL);
@ -481,7 +481,7 @@ static int fec_send(struct eth_device *dev, void *eth_data, int data_length)
* Note: We are always using the first buffer for transmission,
* the second will be empty and only used to stop the DMA engine
*/
if (cpu_is_mx28())
if (fec_is_imx28(fec))
eth_data = imx28_fix_endianess_wr(eth_data, (data_length + 3) >> 2);
writew(data_length, &fec->tbd_base[fec->tbd_index].data_length);
@ -548,7 +548,7 @@ static int fec_recv(struct eth_device *dev)
printf("some error: 0x%08x\n", ievent);
return 0;
}
if (!cpu_is_mx28()) {
if (!fec_is_imx28(fec)) {
if (ievent & FEC_IEVENT_HBERR) {
/* Heartbeat error */
writel(readl(fec->regs + FEC_X_CNTRL) | 0x1,
@ -574,7 +574,7 @@ static int fec_recv(struct eth_device *dev)
if ((bd_status & FEC_RBD_LAST) && !(bd_status & FEC_RBD_ERR) &&
((readw(&rbd->data_length) - 4) > 14)) {
if (cpu_is_mx28())
if (fec_is_imx28(fec))
imx28_fix_endianess_rd(
phys_to_virt(readl(&rbd->data_pointer)),
(readw(&rbd->data_length) + 3) >> 2);
@ -628,10 +628,17 @@ static int fec_probe(struct device_d *dev)
struct fec_priv *fec;
void *base;
int ret;
enum fec_type type;
ret = dev_get_drvdata(dev, (unsigned long *)&type);
if (ret)
return ret;
#ifdef CONFIG_ARCH_IMX27
PCCR0 |= PCCR0_FEC_EN;
#endif
fec = xzalloc(sizeof(*fec));
fec->type = type;
edev = &fec->edev;
dev->priv = fec;
edev->priv = fec;
@ -675,14 +682,19 @@ static int fec_probe(struct device_d *dev)
fec_alloc_receive_packets(fec, FEC_RBD_NUM, FEC_MAX_PKT_SIZE);
fec->xcv_type = pdata->xcv_type;
if (pdata) {
fec->xcv_type = pdata->xcv_type;
fec->phy_init = pdata->phy_init;
fec->phy_addr = pdata->phy_addr;
} else {
fec->xcv_type = MII100;
fec->phy_addr = -1;
}
if (fec->xcv_type != SEVENWIRE) {
fec->phy_init = pdata->phy_init;
fec->miibus.read = fec_miibus_read;
fec->miibus.write = fec_miibus_write;
fec->phy_addr = pdata->phy_addr;
switch (pdata->xcv_type) {
switch (fec->xcv_type) {
case RMII:
fec->interface = PHY_INTERFACE_MODE_RMII;
break;
@ -719,13 +731,45 @@ static void fec_remove(struct device_d *dev)
fec_halt(&fec->edev);
}
static __maybe_unused struct of_device_id imx_fec_dt_ids[] = {
{
.compatible = "fsl,imx27-fec",
.data = FEC_TYPE_IMX27,
}, {
.compatible = "fsl,imx28-fec",
.data = FEC_TYPE_IMX28,
}, {
.compatible = "fsl,imx6q-fec",
.data = FEC_TYPE_IMX6,
}, {
/* sentinel */
}
};
static struct platform_device_id imx_fec_ids[] = {
{
.name = "imx27-fec",
.driver_data = (unsigned long)FEC_TYPE_IMX27,
}, {
.name = "imx28-fec",
.driver_data = (unsigned long)FEC_TYPE_IMX28,
}, {
.name = "imx6-fec",
.driver_data = (unsigned long)FEC_TYPE_IMX6,
}, {
/* sentinel */
},
};
/**
* Driver description for registering
*/
static struct driver_d fec_driver = {
.name = "fec_imx",
.probe = fec_probe,
.name = "fec_imx",
.probe = fec_probe,
.remove = fec_remove,
.of_compatible = DRV_OF_COMPAT(imx_fec_dt_ids),
.id_table = imx_fec_ids,
};
static int fec_register(void)

View File

@ -122,6 +122,12 @@ struct buffer_descriptor {
uint32_t data_pointer; /**< payload's buffer address */
};
enum fec_type {
FEC_TYPE_IMX27,
FEC_TYPE_IMX28,
FEC_TYPE_IMX6,
};
/**
* @brief i.MX27-FEC private structure
*/
@ -139,8 +145,24 @@ struct fec_priv {
struct mii_bus miibus;
void (*phy_init)(struct phy_device *dev);
struct clk *clk;
enum fec_type type;
};
static inline int fec_is_imx27(struct fec_priv *priv)
{
return priv->type == FEC_TYPE_IMX27;
}
static inline int fec_is_imx28(struct fec_priv *priv)
{
return priv->type == FEC_TYPE_IMX28;
}
static inline int fec_is_imx6(struct fec_priv *priv)
{
return priv->type == FEC_TYPE_IMX6;
}
/**
* @brief Numbers of buffer descriptors for receiving
*

View File

@ -38,20 +38,6 @@
#define UBIR 0xa4 /* BRM Incremental Register */
#define UBMR 0xa8 /* BRM Modulator Register */
#define UBRC 0xac /* Baud Rate Count Register */
#ifdef CONFIG_ARCH_IMX1
#define BIPR1 0xb0 /* Incremental Preset Register 1 */
#define BIPR2 0xb4 /* Incremental Preset Register 2 */
#define BIPR3 0xb8 /* Incremental Preset Register 3 */
#define BIPR4 0xbc /* Incremental Preset Register 4 */
#define BMPR1 0xc0 /* BRM Modulator Register 1 */
#define BMPR2 0xc4 /* BRM Modulator Register 2 */
#define BMPR3 0xc8 /* BRM Modulator Register 3 */
#define BMPR4 0xcc /* BRM Modulator Register 4 */
#define UTS 0xd0 /* UART Test Register */
#else
#define ONEMS 0xb0 /* One Millisecond register */
#define UTS 0xb4 /* UART Test Register */
#endif
/* UART Control Register Bit Fields.*/
#define URXD_CHARRDY (1<<15)
@ -148,23 +134,29 @@
/*
* create default values for different platforms
*/
#ifdef CONFIG_ARCH_IMX1
# define UCR1_VAL (UCR1_UARTCLKEN)
# define UCR3_VAL 0
# define UCR4_VAL (UCR4_CTSTL_32 | UCR4_REF16)
#endif
#if defined CONFIG_ARCH_IMX21 || defined CONFIG_ARCH_IMX27
# define UCR1_VAL (UCR1_UARTCLKEN)
# define UCR3_VAL (0x700 | UCR3_RXDMUXSEL)
# define UCR4_VAL UCR4_CTSTL_32
#endif
#if defined CONFIG_ARCH_IMX31 || defined CONFIG_ARCH_IMX35 || \
defined CONFIG_ARCH_IMX25 || defined CONFIG_ARCH_IMX51 || \
defined CONFIG_ARCH_IMX53 || defined CONFIG_ARCH_IMX6
# define UCR1_VAL (0)
# define UCR3_VAL (0x700 | UCR3_RXDMUXSEL)
# define UCR4_VAL UCR4_CTSTL_32
#endif
struct imx_serial_devtype_data {
u32 ucr1_val;
u32 ucr3_val;
u32 ucr4_val;
u32 uts;
u32 onems;
};
struct imx_serial_devtype_data imx1_data = {
.ucr1_val = UCR1_UARTCLKEN,
.ucr3_val = 0,
.ucr4_val = UCR4_CTSTL_32 | UCR4_REF16,
.uts = 0xd0,
.onems = 0,
};
struct imx_serial_devtype_data imx21_data = {
.ucr1_val = 0,
.ucr3_val = 0x700 | UCR3_RXDMUXSEL,
.ucr4_val = UCR4_CTSTL_32,
.uts = 0xb4,
.onems = 0xb0,
};
struct imx_serial_priv {
struct console_device cdev;
@ -172,6 +164,7 @@ struct imx_serial_priv {
struct notifier_block notify;
void __iomem *regs;
struct clk *clk;
struct imx_serial_devtype_data *devtype;
};
static int imx_serial_reffreq(struct imx_serial_priv *priv)
@ -196,23 +189,23 @@ static int imx_serial_init_port(struct console_device *cdev)
void __iomem *regs = priv->regs;
uint32_t val;
writel(UCR1_VAL, regs + UCR1);
writel(priv->devtype->ucr1_val, regs + UCR1);
writel(UCR2_WS | UCR2_IRTS, regs + UCR2);
writel(UCR3_VAL, regs + UCR3);
writel(UCR4_VAL, regs + UCR4);
writel(priv->devtype->ucr3_val, regs + UCR3);
writel(priv->devtype->ucr4_val, regs + UCR4);
writel(0x0000002B, regs + UESC);
writel(0, regs + UTIM);
writel(0, regs + UBIR);
writel(0, regs + UBMR);
writel(0, regs + UTS);
writel(0, regs + priv->devtype->uts);
/* Configure FIFOs */
writel(0xa81, regs + UFCR);
#ifdef ONEMS
writel(imx_serial_reffreq(priv) / 1000, regs + ONEMS);
#endif
if (priv->devtype->onems)
writel(imx_serial_reffreq(priv) / 1000, regs + priv->devtype->onems);
/* Enable FIFOs */
val = readl(regs + UCR2);
@ -240,7 +233,7 @@ static void imx_serial_putc(struct console_device *cdev, char c)
struct imx_serial_priv, cdev);
/* Wait for Tx FIFO not full */
while (readl(priv->regs + UTS) & UTS_TXFULL);
while (readl(priv->regs + priv->devtype->uts) & UTS_TXFULL);
writel(c, priv->regs + URTX0);
}
@ -251,7 +244,7 @@ static int imx_serial_tstc(struct console_device *cdev)
struct imx_serial_priv, cdev);
/* If receive fifo is empty, return false */
if (readl(priv->regs + UTS) & UTS_RXEMPTY)
if (readl(priv->regs + priv->devtype->uts) & UTS_RXEMPTY)
return 0;
return 1;
}
@ -262,7 +255,7 @@ static int imx_serial_getc(struct console_device *cdev)
struct imx_serial_priv, cdev);
unsigned char ch;
while (readl(priv->regs + UTS) & UTS_RXEMPTY);
while (readl(priv->regs + priv->devtype->uts) & UTS_RXEMPTY);
ch = readl(priv->regs + URXD0);
@ -318,9 +311,15 @@ static int imx_serial_probe(struct device_d *dev)
struct console_device *cdev;
struct imx_serial_priv *priv;
uint32_t val;
struct imx_serial_devtype_data *devtype;
int ret;
ret = dev_get_drvdata(dev, (unsigned long *)&devtype);
if (ret)
return ret;
priv = xzalloc(sizeof(*priv));
priv->devtype = devtype;
cdev = &priv->cdev;
dev->priv = priv;
@ -371,20 +370,33 @@ static void imx_serial_remove(struct device_d *dev)
static __maybe_unused struct of_device_id imx_serial_dt_ids[] = {
{
.compatible = "fsl,imx1-uart",
.data = 0,
.data = (unsigned long)&imx1_data,
}, {
.compatible = "fsl,imx21-uart",
.data = 1,
.data = (unsigned long)&imx21_data,
}, {
/* sentinel */
}
};
static struct platform_device_id imx_serial_ids[] = {
{
.name = "imx1-uart",
.driver_data = (unsigned long)&imx1_data,
}, {
.name = "imx21-uart",
.driver_data = (unsigned long)&imx21_data,
}, {
/* sentinel */
},
};
static struct driver_d imx_serial_driver = {
.name = "imx_serial",
.probe = imx_serial_probe,
.remove = imx_serial_remove,
.of_compatible = DRV_OF_COMPAT(imx_serial_dt_ids),
.id_table = imx_serial_ids,
};
static int imx_serial_init(void)