diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2020-11-10 15:07:31 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2020-11-10 15:07:31 +0100 |
commit | 0b0eada569b198aa3882cfec5874bc35a8a0fa14 (patch) | |
tree | 061ca4528bfaee38df3faae6ff1a6be6d4993fe6 /drivers | |
parent | 34ea8b9317afad6ed2cb702c911cbcbad9d3bf23 (diff) | |
parent | 706ef1bf6fed8dd2c75c469ad4bc758da2cb4cf3 (diff) | |
download | barebox-0b0eada569b198aa3882cfec5874bc35a8a0fa14.tar.gz barebox-0b0eada569b198aa3882cfec5874bc35a8a0fa14.tar.xz |
Merge branch 'for-next/misc'
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mci/stm32_sdmmc2.c | 7 | ||||
-rw-r--r-- | drivers/mfd/mc34704.c | 4 | ||||
-rw-r--r-- | drivers/mtd/nand/nand_imx.c | 15 | ||||
-rw-r--r-- | drivers/net/macb.c | 55 | ||||
-rw-r--r-- | drivers/of/base.c | 3 |
5 files changed, 59 insertions, 25 deletions
diff --git a/drivers/mci/stm32_sdmmc2.c b/drivers/mci/stm32_sdmmc2.c index da2dc592ad..0c620427ee 100644 --- a/drivers/mci/stm32_sdmmc2.c +++ b/drivers/mci/stm32_sdmmc2.c @@ -633,11 +633,16 @@ priv_free: } static struct amba_id stm32_sdmmc2_ids[] = { - /* ST Micro STM32MP157C */ + /* ST Micro STM32MP15 v1.1 */ { .id = 0x10153180, .mask = 0xf0ffffff, }, + /* ST Micro STM32MP15 v2.0 */ + { + .id = 0x00253180, + .mask = 0xf0ffffff, + }, { 0, 0 }, }; diff --git a/drivers/mfd/mc34704.c b/drivers/mfd/mc34704.c index 4aa02b74ff..29071c5ccf 100644 --- a/drivers/mfd/mc34704.c +++ b/drivers/mfd/mc34704.c @@ -43,7 +43,7 @@ int mc34704_reg_read(struct mc34704 *mc34704, u8 reg, u8 *val) { int ret; - ret = i2c_read_reg(mc34704->client, reg, val, 1); + ret = i2c_read_reg(mc34704->client, 1 << 7 | reg, val, 1); return ret == 1 ? 0 : ret; } @@ -112,7 +112,7 @@ static int mc34704_probe(struct device_d *dev) mc34704_dev = xzalloc(sizeof(struct mc34704)); mc34704_dev->cdev.name = DRIVERNAME; mc34704_dev->client = to_i2c_client(dev); - mc34704_dev->cdev.size = 256; + mc34704_dev->cdev.size = 128; mc34704_dev->cdev.dev = dev; mc34704_dev->cdev.ops = &mc34704_fops; diff --git a/drivers/mtd/nand/nand_imx.c b/drivers/mtd/nand/nand_imx.c index d69a012f01..f9d3c2e34a 100644 --- a/drivers/mtd/nand/nand_imx.c +++ b/drivers/mtd/nand/nand_imx.c @@ -996,14 +996,23 @@ static void imx_nand_command(struct mtd_info *mtd, unsigned command, else host->buf_start = column + mtd->writesize; - command = NAND_CMD_READ0; - - host->send_cmd(host, command); + host->send_cmd(host, NAND_CMD_READ0); mxc_do_addr_cycle(mtd, column, page_addr); if (host->pagesize_2k) /* send read confirm command */ host->send_cmd(host, NAND_CMD_READSTART); + + /* + * After the core issued READOOB the result is read using + * .read_buf, so we have to make sure the data is actually + * there. + */ + if (command == NAND_CMD_READOOB) { + host->send_page(host, NFC_OUTPUT); + copy_spare(mtd, 1, host->data_buf + mtd->writesize); + } + break; case NAND_CMD_SEQIN: diff --git a/drivers/net/macb.c b/drivers/net/macb.c index e3e039f679..188dbf2d8c 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c @@ -144,8 +144,6 @@ static void reclaim_rx_buffers(struct macb_device *macb, { unsigned int i; - dev_dbg(macb->dev, "%s\n", __func__); - i = macb->rx_tail; while (i > new_tail) { macb->rx_ring[i].addr &= ~MACB_BIT(RX_USED); @@ -170,8 +168,6 @@ static int gem_recv(struct eth_device *edev) int length; u32 status; - dev_dbg(macb->dev, "%s\n", __func__); - for (;;) { barrier(); if (!(macb->rx_ring[macb->rx_tail].addr & MACB_BIT(RX_USED))) @@ -206,8 +202,6 @@ static int macb_recv(struct eth_device *edev) int wrapped = 0; u32 status; - dev_dbg(macb->dev, "%s\n", __func__); - for (;;) { barrier(); if (!(macb->rx_ring[rx_tail].addr & MACB_BIT(RX_USED))) @@ -264,9 +258,38 @@ static int macb_recv(struct eth_device *edev) return 0; } +static int macb_set_tx_clk(struct macb_device *macb, int speed) +{ + int rate; + int rate_rounded; + + if (!macb->txclk) { + dev_dbg(macb->dev, "txclk not available\n"); + return 0; + } + + switch (speed) { + case SPEED_100: + rate = 25000000; + break; + case SPEED_1000: + rate = 125000000; + break; + default: + return -EINVAL; + } + + rate_rounded = clk_round_rate(macb->txclk, rate); + if (rate_rounded <= 0) + return -EINVAL; + + return clk_set_rate(macb->txclk, rate_rounded); +} + static void macb_adjust_link(struct eth_device *edev) { struct macb_device *macb = edev->priv; + int err; u32 reg; reg = macb_readl(macb, NCFGR); @@ -282,14 +305,16 @@ static void macb_adjust_link(struct eth_device *edev) reg |= GEM_BIT(GBE); macb_or_gem_writel(macb, NCFGR, reg); + + err = macb_set_tx_clk(macb, edev->phydev->speed); + if (err) + dev_warn(macb->dev, "cannot set txclk\n"); } static int macb_open(struct eth_device *edev) { struct macb_device *macb = edev->priv; - dev_dbg(macb->dev, "%s\n", __func__); - /* Enable TX and RX */ macb_writel(macb, NCR, MACB_BIT(TE) | MACB_BIT(RE)); @@ -340,7 +365,7 @@ static int gmac_init_dummy_tx_queues(struct macb_device *macb) MACB_BIT(TX_LAST) | MACB_BIT(TX_USED); for (i = 1; i < num_queues; i++) - gem_writel_queue_TBQP(macb, &macb->gem_q1_descs[0], i - 1); + gem_writel_queue_TBQP(macb, (ulong)macb->gem_q1_descs, i - 1); return 0; } @@ -350,8 +375,6 @@ static void macb_init(struct macb_device *macb) unsigned long paddr, val = 0; int i; - dev_dbg(macb->dev, "%s\n", __func__); - /* * macb_halt should have been called at some point before now, * so we'll assume the controller is idle. @@ -441,8 +464,6 @@ static int macb_phy_read(struct mii_bus *bus, int addr, int reg) int value; uint64_t start; - dev_dbg(macb->dev, "%s\n", __func__); - netctl = macb_readl(macb, NCR); netctl |= MACB_BIT(MPE); macb_writel(macb, NCR, netctl); @@ -478,8 +499,6 @@ static int macb_phy_write(struct mii_bus *bus, int addr, int reg, u16 value) unsigned long netctl; unsigned long frame; - dev_dbg(macb->dev, "%s\n", __func__); - netctl = macb_readl(macb, NCR); netctl |= MACB_BIT(MPE); macb_writel(macb, NCR, netctl); @@ -510,8 +529,6 @@ static int macb_get_ethaddr(struct eth_device *edev, unsigned char *adr) u8 addr[6]; int i; - dev_dbg(macb->dev, "%s\n", __func__); - /* Check all 4 address register for vaild address */ for (i = 0; i < 4; i++) { bottom = macb_or_gem_readl(macb, SA1B + i * 8); @@ -537,8 +554,6 @@ static int macb_set_ethaddr(struct eth_device *edev, const unsigned char *adr) { struct macb_device *macb = edev->priv; - dev_dbg(macb->dev, "%s\n", __func__); - /* set hardware address */ macb_or_gem_writel(macb, SA1B, adr[0] | adr[1] << 8 | adr[2] << 16 | adr[3] << 24); macb_or_gem_writel(macb, SA1T, adr[4] | adr[5] << 8); @@ -742,6 +757,8 @@ static int macb_probe(struct device_d *dev) macb->txclk = clk_get(dev, "tx_clk"); if (!IS_ERR(macb->txclk)) clk_enable(macb->txclk); + else + macb->txclk = NULL; macb->rxclk = clk_get(dev, "rx_clk"); if (!IS_ERR(macb->rxclk)) diff --git a/drivers/of/base.c b/drivers/of/base.c index 5b45c2023f..c39da558d1 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -2203,6 +2203,9 @@ int of_add_memory(struct device_node *node, bool dump) if (!resource_size(&res)) continue; + if (!of_device_is_available(node)) + continue; + of_add_memory_bank(node, dump, mem_bank_num, res.start, resource_size(&res)); mem_bank_num++; |