Fix Ethernet boot in am335x
cover Fix Ethernet boot in am335x
The following patches fix ethernet boot in am335x.
Enabling OF_CONTROL in SPL makes it overflow the sram size. To avoid this, I am using static platdata in the am335x board file instead of the fdtdec_*() calls used in ofdata_to_platdata().
Patches 1-5 isolate the two operations of getting platform data (all of which should happen in _ofdata_to_platdata()) and initial configurations (all of which should happen in _probe()).
Patch 6 makes sure the cpsw driver gets probed in SPL. Patch 7 adds static platdata to the am335 board file. Patches 8-10 makes changes in the config to make space for and enable ETH_SUPPORT in SPL.
Patch 11 removes non-DM_ETH code from the am335x board file.
Tested ethernet boot and tftp in am335x-evm. Regression tested on dra71x-evm.
Faiz Abbas (11):
net: Add priv_pdata to eth_pdata
net: ti: cpsw: Move cpsw_phy_sel() to _probe()
net: ti: cpsw: Convert cpsw_platform_data to a pointer in cpsw_priv
net: ti: cpsw-common: Isolate getting syscon address from assigning
macid
net: ti: cpsw: Block off ofdata_to_platdata with OF_CONTROL
net: ti: cpsw: Enable DM_FLAG_PRE_RELOC
board: ti: am335x: Add platdata for cpsw in SPL
configs: am335x_evm: Reduce size of SPL
configs: am335x_evm: Add Support for SPL_ETH
configs: am335x_evm: Update VCI String
board: ti: am335x: Remove non DM_ETH code
board/ti/am335x/board.c | 170 ++++++----------------------- configs/am335x_evm_defconfig | 8 +- drivers/net/ti/cpsw-common.c | 127 ++++++++++------------ drivers/net/ti/cpsw.c | 202 ++++++++++++++++------------------- include/cpsw.h | 25 ++++- include/net.h | 2 + 6 files changed, 217 insertions(+), 317 deletions(-)
Signature · 1 line
2.19.2
PATCH 1/11 net: Add priv_pdata to eth_pdata
Add a priv member for eth_pdata for platform specific platform data.
--- include/net.h | 2 ++ 1 file changed, 2 insertions(+)
include/net.h +2 -0
@@ -92,12 +92,14 @@ enum eth_state_t {* @enetaddr: The Ethernet MAC address that is loaded from EEPROM or env * @phy_interface: PHY interface to use - see PHY_INTERFACE_MODE_... * @max_speed: Maximum speed of Ethernet connection supported by MAC +* @priv_pdata: device specific platdata */ struct eth_pdata {phys_addr_t iobase;unsigned char enetaddr[ARP_HLEN ];int phy_interface;int max_speed; +void *priv_pdata; };enum eth_recv_flags {
Signature · 1 line
2.19.2
PATCH 1/11 net: Add priv_pdata to eth_pdata
Quoted 3 lines · Faiz Abbas
Add a priv member for
eth_pdatafor platform specific platform data.Signed-off-by Faiz Abbas <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190412/ed285476/attachment.sig>
PATCH 2/11 net: ti: cpsw: Move cpsw_phy_sel() to _probe()
In reply to Faiz Abbascpsw_phy_sel() is a configuration step that should not be in ofdata_to_platdata(). Add phy_sel_compat to the cpsw_platform_data structure so that it is accessible in _probe. Then move the call of cpsw_phy_sel() to _probe.
--- drivers/net/ti/cpsw.c | 33 ++++++++++++++++----------------- include/cpsw.h | 1 + 2 files changed, 17 insertions(+), 17 deletions(-)
drivers/net/ti/cpsw.c +16 -17
@@ -1048,16 +1048,6 @@ static void cpsw_eth_stop(struct udevice *dev)return _cpsw_halt (priv); } - -static int cpsw_eth_probe (struct udevice *dev) -{ -struct cpsw_priv *priv =dev_get_priv (dev); - - priv->dev = dev; - -return _cpsw_register (priv); -} -static const struct eth_ops cpsw_eth_ops = { .start = cpsw_eth_start, .send = cpsw_eth_send,
@@ -1188,13 +1178,25 @@ static void cpsw_phy_sel(struct cpsw_priv *priv, const char *compat,cpsw_gmii_sel_dra7xx (priv, phy_mode); } +static int cpsw_eth_probe (struct udevice *dev) +{ +struct cpsw_priv *priv =dev_get_priv (dev); +struct eth_pdata *pdata =dev_get_platdata (dev); + + priv->dev = dev; +/* Select phy interface in control module */ +cpsw_phy_sel (priv, priv->data.phy_sel_compat, + pdata->phy_interface); + +return _cpsw_register (priv); +} +static int cpsw_eth_ofdata_to_platdata (struct udevice *dev) {struct eth_pdata *pdata =dev_get_platdata (dev);struct cpsw_priv *priv =dev_get_priv (dev);struct gpio_desc *mode_gpios;const char *phy_mode; -const char *phy_sel_compat =NULL ;const void *fdt = gd->fdt_blob;int node =dev_of_offset (dev);int subnode;
@@ -1315,9 +1317,9 @@ static int cpsw_eth_ofdata_to_platdata(struct udevice *dev) NULL)) priv->data.rmii_clock_external = true; - phy_sel_compat =fdt_getprop (fdt, subnode,"compatible" , -NULL ); -if (!phy_sel_compat) { + priv->data.phy_sel_compat =fdt_getprop (fdt, subnode, +"compatible" ,NULL ); +if (!priv->data.phy_sel_compat) {pr_err ("Not able to get gmii_sel compatible\n" );return -ENOENT ; }
@@ -1344,9 +1346,6 @@ static int cpsw_eth_ofdata_to_platdata(struct udevice *dev)return -EINVAL ; } -/* Select phy interface in control module */ -cpsw_phy_sel (priv, phy_sel_compat, pdata->phy_interface); -return 0 ; }
include/cpsw.h +1 -0
@@ -50,6 +50,7 @@ struct cpsw_platform_data {u32 active_slave;bool rmii_clock_external;u8 version; +const char *phy_sel_compat; };int cpsw_register (struct cpsw_platform_data *data);
Signature · 1 line
2.19.2
PATCH 2/11 net: ti: cpsw: Move cpsw_phy_sel() to _probe()
Quoted 6 lines · Faiz Abbas
cpsw_phy_sel()is a configuration step that should not be inofdata_to_platdata(). Addphy_sel_compatto thecpsw_platform_datastructure so that it is accessible in_probe. Then move the call ofcpsw_phy_sel()to_probe.Signed-off-by Faiz Abbas <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190412/91410fba/attachment.sig>
PATCH 3/11 net: ti: cpsw: Convert cpsw_platform_data to a pointer in cpsw_priv
In reply to Faiz AbbasConvert cpsw_platform_data to a pointer in cpsw_priv. Allocate it dynamically and assign it as a part of eth_pdata. This helps in isolating platform data handling and implementing platdata for SPL in a board file.
--- drivers/net/ti/cpsw.c | 136 +++++++++++++++++++++--------------------- 1 file changed, 69 insertions(+), 67 deletions(-)
drivers/net/ti/cpsw.c +69 -67
@@ -209,10 +209,10 @@ struct cpdma_chan {#define chan_read_ptr (chan, fld) ((void *)__raw_readl((chan)->fld))#define for_active_slave (slave, priv) \ - slave = (priv)->slaves + (priv)->data.active_slave; if (slave) + slave = (priv)->slaves + ((priv)->data)->active_slave; if (slave)#define for_each_slave (slave, priv) \ for (slave = (priv)->slaves; slave != (priv)->slaves + \ - (priv)->data.slaves; slave++) + ((priv)->data)->slaves; slave++)struct cpsw_priv {#ifdef CONFIG_DM_ETH
@@ -220,7 +220,7 @@ struct cpsw_priv {#else struct eth_device *dev;#endif -struct cpsw_platform_data data; +struct cpsw_platform_data *data;int host_port;struct cpsw_regs *regs;
@@ -327,7 +327,7 @@ static int cpsw_ale_match_addr(struct cpsw_priv *priv, const u8 *addr)u32 ale_entry[ALE_ENTRY_WORDS ];int type, idx; -for (idx =0 ; idx < priv->data.ale_entries; idx++) { +for (idx =0 ; idx < priv->data->ale_entries; idx++) {u8 entry_addr[6 ];cpsw_ale_read (priv, idx, ale_entry);
@@ -346,7 +346,7 @@ static int cpsw_ale_match_free(struct cpsw_priv *priv)u32 ale_entry[ALE_ENTRY_WORDS ];int type, idx; -for (idx =0 ; idx < priv->data.ale_entries; idx++) { +for (idx =0 ; idx < priv->data->ale_entries; idx++) {cpsw_ale_read (priv, idx, ale_entry); type =cpsw_ale_get_entry_type (ale_entry);if (type ==ALE_TYPE_FREE )
@@ -360,7 +360,7 @@ static int cpsw_ale_find_ageable(struct cpsw_priv *priv)u32 ale_entry[ALE_ENTRY_WORDS ];int type, idx; -for (idx =0 ; idx < priv->data.ale_entries; idx++) { +for (idx =0 ; idx < priv->data->ale_entries; idx++) {cpsw_ale_read (priv, idx, ale_entry); type =cpsw_ale_get_entry_type (ale_entry);if (type !=ALE_TYPE_ADDR && type !=ALE_TYPE_VLAN_ADDR )
@@ -500,7 +500,7 @@ static int cpsw_slave_update_link(struct cpsw_slave *slave, *link = phy->link;if (phy->link) {/* link up */ - mac_control = priv->data.mac_control; + mac_control = priv->data->mac_control;if (phy->speed ==1000 ) mac_control |=GIGABITEN ;if (phy->duplex ==DUPLEX_FULL )
@@ -710,7 +710,7 @@ static int _cpsw_init(struct cpsw_priv *priv, u8 *enetaddr) priv->desc_free = &priv->descs[0 ];/* initialize channels */ -if (priv->data.version ==CPSW_CTRL_VERSION_2 ) { +if (priv->data->version ==CPSW_CTRL_VERSION_2 ) {memset (&priv->rx_chan,0 ,sizeof (struct cpdma_chan )); priv->rx_chan.hdp = priv->dma_regs +CPDMA_RXHDP_VER2 ; priv->rx_chan.cp = priv->dma_regs +CPDMA_RXCP_VER2 ;
@@ -733,8 +733,8 @@ static int _cpsw_init(struct cpsw_priv *priv, u8 *enetaddr)/* clear dma state */ setbit_and_wait_for_clear32 (priv->dma_regs +CPDMA_SOFTRESET ); -if (priv->data.version ==CPSW_CTRL_VERSION_2 ) { -for (i =0 ; i < priv->data.channels; i++) { +if (priv->data->version ==CPSW_CTRL_VERSION_2 ) { +for (i =0 ; i < priv->data->channels; i++) {__raw_writel (0 , priv->dma_regs +CPDMA_RXHDP_VER2 +4 * i); __raw_writel(0, priv->dma_regs + CPDMA_RXFREE + 4
@@ -747,7 +747,7 @@ static int _cpsw_init(struct cpsw_priv *priv, u8 *enetaddr) * i); } }else { -for (i =0 ; i < priv->data.channels; i++) { +for (i =0 ; i < priv->data->channels; i++) {__raw_writel (0 , priv->dma_regs +CPDMA_RXHDP_VER1 +4 * i); __raw_writel(0, priv->dma_regs + CPDMA_RXFREE + 4
@@ -843,7 +843,7 @@ static void cpsw_slave_setup(struct cpsw_slave *slave, int slave_num, struct cpsw_priv *priv) {void *regs = priv->regs; -struct cpsw_slave_data *data = priv->data.slave_data + slave_num; +struct cpsw_slave_data *data = priv->data->slave_data + slave_num; slave->slave_num = slave_num; slave->data = data; slave->regs = regs + data->slave_reg_ofs;
@@ -879,7 +879,7 @@ static int cpsw_phy_init(struct cpsw_priv *priv, struct cpsw_slave *slave)static void cpsw_phy_addr_update (struct cpsw_priv *priv) { -struct cpsw_platform_data *data = &priv->data; +struct cpsw_platform_data *data = priv->data;u16 alive =cpsw_mdio_get_alive (priv->bus);int active = data->active_slave;int new_addr =ffs (alive) -1 ;
@@ -899,7 +899,7 @@ static void cpsw_phy_addr_update(struct cpsw_priv *priv)int _cpsw_register (struct cpsw_priv *priv) {struct cpsw_slave *slave; -struct cpsw_platform_data *data = &priv->data; +struct cpsw_platform_data *data = priv->data;void *regs = (void *)data->cpsw_base; priv->slaves =malloc (sizeof (struct cpsw_slave ) * data->slaves);
@@ -988,7 +988,7 @@ int cpsw_register(struct cpsw_platform_data *data) } priv->dev = dev; - priv->data = *data; + priv->data = data;strcpy (dev->name,"cpsw" ); dev->iobase =0 ;
@@ -1069,9 +1069,9 @@ static void cpsw_gmii_sel_am3352(struct cpsw_priv *priv,u32 mask;u32 mode =0 ;bool rgmii_id = false; -int slave = priv->data.active_slave; +int slave = priv->data->active_slave; - reg =readl (priv->data.gmii_sel); + reg =readl (priv->data->gmii_sel);switch (phy_mode) {case PHY_INTERFACE_MODE_RMII :
@@ -1097,7 +1097,7 @@ static void cpsw_gmii_sel_am3352(struct cpsw_priv *priv, mask =GMII_SEL_MODE_MASK << (slave *2 ) |BIT (slave +6 ); mode <<= slave *2 ; -if (priv->data.rmii_clock_external) { +if (priv->data->rmii_clock_external) {if (slave ==0 ) mode |=AM33XX_GMII_SEL_RMII1_IO_CLK_EN ;else
@@ -1114,7 +1114,7 @@ static void cpsw_gmii_sel_am3352(struct cpsw_priv *priv, reg &= ~mask; reg |= mode; -writel (reg, priv->data.gmii_sel); +writel (reg, priv->data->gmii_sel); } static void cpsw_gmii_sel_dra7xx(struct cpsw_priv *priv,
@@ -1123,9 +1123,9 @@ static void cpsw_gmii_sel_dra7xx(struct cpsw_priv *priv,u32 reg;u32 mask;u32 mode =0 ; -int slave = priv->data.active_slave; +int slave = priv->data->active_slave; - reg =readl (priv->data.gmii_sel); + reg =readl (priv->data->gmii_sel);switch (phy_mode) {case PHY_INTERFACE_MODE_RMII :
@@ -1158,13 +1158,13 @@ static void cpsw_gmii_sel_dra7xx(struct cpsw_priv *priv,return ; } -if (priv->data.rmii_clock_external) +if (priv->data->rmii_clock_external)dev_err (priv->dev,"RMII External clock is not supported\n" ); reg &= ~mask; reg |= mode; -writel (reg, priv->data.gmii_sel); +writel (reg, priv->data->gmii_sel); } static void cpsw_phy_sel(struct cpsw_priv *priv, const char *compat,
@@ -1184,8 +1184,9 @@ static int cpsw_eth_probe(struct udevice *dev)struct eth_pdata *pdata =dev_get_platdata (dev); priv->dev = dev; + priv->data = pdata->priv_pdata;/* Select phy interface in control module */ -cpsw_phy_sel (priv, priv->data.phy_sel_compat, +cpsw_phy_sel (priv, priv->data->phy_sel_compat, pdata->phy_interface);return _cpsw_register (priv);
@@ -1194,7 +1195,7 @@ static int cpsw_eth_probe(struct udevice *dev)static int cpsw_eth_ofdata_to_platdata (struct udevice *dev) {struct eth_pdata *pdata =dev_get_platdata (dev); -struct cpsw_priv *priv =dev_get_priv (dev); +struct cpsw_platform_data *data;struct gpio_desc *mode_gpios;const char *phy_mode;const void *fdt = gd->fdt_blob;
@@ -1205,45 +1206,47 @@ static int cpsw_eth_ofdata_to_platdata(struct udevice *dev)int num_mode_gpios;int ret; + data =calloc (1 ,sizeof (struct cpsw_platform_data )); + pdata->priv_pdata = data; pdata->iobase =devfdt_get_addr (dev); - priv->data.version =CPSW_CTRL_VERSION_2 ; - priv->data.bd_ram_ofs =CPSW_BD_OFFSET ; - priv->data.ale_reg_ofs =CPSW_ALE_OFFSET ; - priv->data.cpdma_reg_ofs =CPSW_CPDMA_OFFSET ; - priv->data.mdio_div =CPSW_MDIO_DIV ; - priv->data.host_port_reg_ofs =CPSW_HOST_PORT_OFFSET , + data->version =CPSW_CTRL_VERSION_2 ; + data->bd_ram_ofs =CPSW_BD_OFFSET ; + data->ale_reg_ofs =CPSW_ALE_OFFSET ; + data->cpdma_reg_ofs =CPSW_CPDMA_OFFSET ; + data->mdio_div =CPSW_MDIO_DIV ; + data->host_port_reg_ofs =CPSW_HOST_PORT_OFFSET , pdata->phy_interface =-1 ; - priv->data.cpsw_base = pdata->iobase; - priv->data.channels =fdtdec_get_int (fdt, node,"cpdma_channels" ,-1 ); -if (priv->data.channels <=0 ) { + data->cpsw_base = pdata->iobase; + data->channels =fdtdec_get_int (fdt, node,"cpdma_channels" ,-1 ); +if (data->channels <=0 ) {printf ("error: cpdma_channels not found in dt\n" );return -ENOENT ; } - priv->data.slaves =fdtdec_get_int (fdt, node,"slaves" ,-1 ); -if (priv->data.slaves <=0 ) { + data->slaves =fdtdec_get_int (fdt, node,"slaves" ,-1 ); +if (data->slaves <=0 ) {printf ("error: slaves not found in dt\n" );return -ENOENT ; } - priv->data.slave_data =malloc (sizeof (struct cpsw_slave_data ) * - priv->data.slaves); + data->slave_data =malloc (sizeof (struct cpsw_slave_data ) * + data->slaves); - priv->data.ale_entries =fdtdec_get_int (fdt, node,"ale_entries" ,-1 ); -if (priv->data.ale_entries <=0 ) { + data->ale_entries =fdtdec_get_int (fdt, node,"ale_entries" ,-1 ); +if (data->ale_entries <=0 ) {printf ("error: ale_entries not found in dt\n" );return -ENOENT ; } - priv->data.bd_ram_ofs =fdtdec_get_int (fdt, node,"bd_ram_size" ,-1 ); -if (priv->data.bd_ram_ofs <=0 ) { + data->bd_ram_ofs =fdtdec_get_int (fdt, node,"bd_ram_size" ,-1 ); +if (data->bd_ram_ofs <=0 ) {printf ("error: bd_ram_size not found in dt\n" );return -ENOENT ; } - priv->data.mac_control =fdtdec_get_int (fdt, node,"mac_control" ,-1 ); -if (priv->data.mac_control <=0 ) { + data->mac_control =fdtdec_get_int (fdt, node,"mac_control" ,-1 ); +if (data->mac_control <=0 ) {printf ("error: ale_entries not found in dt\n" );return -ENOENT ; }
@@ -1258,7 +1261,7 @@ static int cpsw_eth_ofdata_to_platdata(struct udevice *dev) } active_slave =fdtdec_get_int (fdt, node,"active_slave" ,0 ); - priv->data.active_slave = active_slave; + data->active_slave = active_slave;fdt_for_each_subnode (subnode, fdt, node) {int len;
@@ -1273,65 +1276,64 @@ static int cpsw_eth_ofdata_to_platdata(struct udevice *dev)pr_err ("Not able to get MDIO address space\n" );return -ENOENT ; } - priv->data.mdio_base = mdio_base; + data->mdio_base = mdio_base; }if (!strncmp (name,"slave" ,5 )) {u32 phy_id[2 ]; -if (slave_index >= priv->data.slaves) +if (slave_index >= data->slaves)continue ; phy_mode =fdt_getprop (fdt, subnode,"phy-mode" ,NULL );if (phy_mode) - priv->data.slave_data[slave_index].phy_if = + data->slave_data[slave_index].phy_if =phy_get_interface_by_name (phy_mode); - priv->data.slave_data[slave_index].phy_of_handle = + data->slave_data[slave_index].phy_of_handle =fdtdec_lookup_phandle (fdt, subnode,"phy-handle" ); -if (priv->data.slave_data[slave_index].phy_of_handle >=0 ) { - priv->data.slave_data[slave_index].phy_addr = +if (data->slave_data[slave_index].phy_of_handle >=0 ) { + data->slave_data[slave_index].phy_addr =fdtdec_get_int (gd->fdt_blob, - priv->data.slave_data[slave_index].phy_of_handle, + data->slave_data[slave_index].phy_of_handle,"reg" ,-1 ); }else {fdtdec_get_int_array (fdt, subnode,"phy_id" , phy_id,2 ); - priv->data.slave_data[slave_index].phy_addr = + data->slave_data[slave_index].phy_addr = phy_id[1 ]; } slave_index++; }if (!strncmp (name,"cpsw-phy-sel" ,12 )) { - priv->data.gmii_sel =cpsw_get_addr_by_node (fdt, - subnode); + data->gmii_sel =cpsw_get_addr_by_node (fdt, subnode); -if (priv->data.gmii_sel ==FDT_ADDR_T_NONE ) { +if (data->gmii_sel ==FDT_ADDR_T_NONE ) {pr_err ("Not able to get gmii_sel reg address\n" );return -ENOENT ; }if (fdt_get_property (fdt, subnode,"rmii-clock-ext" ,NULL )) - priv->data.rmii_clock_external = true; + data->rmii_clock_external = true; - priv->data.phy_sel_compat =fdt_getprop (fdt, subnode, -"compatible" ,NULL ); -if (!priv->data.phy_sel_compat) { + data->phy_sel_compat =fdt_getprop (fdt, subnode, +"compatible" ,NULL ); +if (!data->phy_sel_compat) {pr_err ("Not able to get gmii_sel compatible\n" );return -ENOENT ; } } } - priv->data.slave_data[0 ].slave_reg_ofs =CPSW_SLAVE0_OFFSET ; - priv->data.slave_data[0 ].sliver_reg_ofs =CPSW_SLIVER0_OFFSET ; + data->slave_data[0 ].slave_reg_ofs =CPSW_SLAVE0_OFFSET ; + data->slave_data[0 ].sliver_reg_ofs =CPSW_SLIVER0_OFFSET ; -if (priv->data.slaves ==2 ) { - priv->data.slave_data[1 ].slave_reg_ofs =CPSW_SLAVE1_OFFSET ; - priv->data.slave_data[1 ].sliver_reg_ofs =CPSW_SLIVER1_OFFSET ; +if (data->slaves ==2 ) { + data->slave_data[1 ].slave_reg_ofs =CPSW_SLAVE1_OFFSET ; + data->slave_data[1 ].sliver_reg_ofs =CPSW_SLIVER1_OFFSET ; } ret =ti_cm_get_macid (dev, active_slave, pdata->enetaddr);
@@ -1340,7 +1342,7 @@ static int cpsw_eth_ofdata_to_platdata(struct udevice *dev)return ret; } - pdata->phy_interface = priv->data.slave_data[active_slave].phy_if; + pdata->phy_interface = data->slave_data[active_slave].phy_if;if (pdata->phy_interface ==-1 ) {debug ("%s: Invalid PHY interface '%s'\n" , __func__, phy_mode);return -EINVAL ;
@@ -1352,7 +1354,7 @@ static int cpsw_eth_ofdata_to_platdata(struct udevice *dev)int cpsw_get_slave_phy_addr (struct udevice *dev,int slave) {struct cpsw_priv *priv =dev_get_priv (dev); -struct cpsw_platform_data *data = &priv->data; +struct cpsw_platform_data *data = priv->data;return data->slave_data[slave].phy_addr; }
Signature · 1 line
2.19.2
PATCH 3/11 net: ti: cpsw: Convert cpsw_platform_data to a pointer in cpsw_priv
Quoted 6 lines · Faiz Abbas
Convert
cpsw_platform_datato a pointer incpsw_priv. Allocate it dynamically and assign it as a part ofeth_pdata. This helps in isolating platform data handling and implementing platdata for SPL in a board file.Signed-off-by Faiz Abbas <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190412/1ef1a367/attachment.sig>
PATCH 4/11 net: ti: cpsw-common: Isolate getting syscon address from assigning macid
In reply to Faiz Abbasti_cm_get_macid() is used to get a syscon node from the dt, read the efuse address and then assign the macid read from the address. Divide these two steps into separate functions one of which can be called from ofdata_to_platdata() while the other can be called from _probe(). This ensures that platdata can be assigned statically in a board file when OF_CONTROL is not enabled. Also add a macid_sel_compat in private data to get information about the macid byte placement.
--- drivers/net/ti/cpsw-common.c | 127 +++++++++++++++-------------------- drivers/net/ti/cpsw.c | 3 +- include/cpsw.h | 7 +- 3 files changed, 64 insertions(+), 73 deletions(-)
drivers/net/ti/cpsw-common.c +56 -71
@@ -16,35 +16,11 @@ DECLARE_GLOBAL_DATA_PTR;#define CTRL_MAC_REG (offset, id) ((offset) + 0x8 * (id)) -static int davinci_emac_3517_get_macid (struct udevice *dev,u16 offset, -int slave,u8 *mac_addr) +static void davinci_emac_3517_get_macid (u32 addr,u8 *mac_addr) { -void *fdt = (void *)gd->fdt_blob; -int node =dev_of_offset (dev); -u32 macid_lsb; -u32 macid_msb; -fdt32_t gmii =0 ; -int syscon; -u32 addr; - - syscon =fdtdec_lookup_phandle (fdt, node,"syscon" ); -if (syscon <0 ) { -pr_err ("Syscon offset not found\n" ); -return -ENOENT ; - } - - addr = (u32 )map_physmem (fdt_translate_address (fdt, syscon, &gmii), -sizeof (u32),MAP_NOCACHE ); -if (addr ==FDT_ADDR_T_NONE ) { -pr_err ("Not able to get syscon address to get mac efuse address\n" ); -return -ENOENT ; - } - - addr +=CTRL_MAC_REG (offset, slave); -/* try reading mac address from efuse */ - macid_lsb =readl (addr); - macid_msb =readl (addr +4 ); +u32 macid_lsb =readl (addr); +u32 macid_msb =readl (addr +4 ); mac_addr[0 ] = (macid_msb >>16 ) &0xff ; mac_addr[1 ] = (macid_msb >>8 ) &0xff ;
@@ -52,20 +28,62 @@ static int davinci_emac_3517_get_macid(struct udevice *dev, u16 offset, mac_addr[3 ] = (macid_lsb >>16 ) &0xff ; mac_addr[4 ] = (macid_lsb >>8 ) &0xff ; mac_addr[5 ] = macid_lsb &0xff ; +} -return 0 ; +static void cpsw_am33xx_cm_get_macid (u32 addr,u8 *mac_addr) +{ +/* try reading mac address from efuse */ +u32 macid_lo =readl (addr); +u32 macid_hi =readl (addr +4 ); + + mac_addr[5 ] = (macid_lo >>8 ) &0xff ; + mac_addr[4 ] = macid_lo &0xff ; + mac_addr[3 ] = (macid_hi >>24 ) &0xff ; + mac_addr[2 ] = (macid_hi >>16 ) &0xff ; + mac_addr[1 ] = (macid_hi >>8 ) &0xff ; + mac_addr[0 ] = macid_hi &0xff ; +} + +void ti_cm_get_macid (struct udevice *dev,struct cpsw_platform_data *data, +u8 *mac_addr) +{ +if (!strcmp (data->macid_sel_compat,"cpsw,am33xx" )) +cpsw_am33xx_cm_get_macid (data->syscon_addr, mac_addr); +else if (!strcmp (data->macid_sel_compat,"davinci,emac" )) +davinci_emac_3517_get_macid (data->syscon_addr, mac_addr); } -static int cpsw_am33xx_cm_get_macid (struct udevice *dev,u16 offset,int slave, -u8 *mac_addr) +int ti_cm_get_macid_addr (struct udevice *dev,int slave, +struct cpsw_platform_data *data) {void *fdt = (void *)gd->fdt_blob;int node =dev_of_offset (dev); -u32 macid_lo; -u32 macid_hi;fdt32_t gmii =0 ;int syscon; -u32 addr; +u16 offset; + +if (of_machine_is_compatible ("ti,dm8148" )) { + offset =0x630 ; + data->macid_sel_compat ="cpsw,am33xx" ; + }else if (of_machine_is_compatible ("ti,am33xx" )) { + offset =0x630 ; + data->macid_sel_compat ="cpsw,am33xx" ; + }else if (device_is_compatible (dev,"ti,am3517-emac" )) { + offset =0x110 ; + data->macid_sel_compat ="davinci,emac" ; + }else if (device_is_compatible (dev,"ti,dm816-emac" )) { + offset =0x30 ; + data->macid_sel_compat ="cpsw,am33xx" ; + }else if (of_machine_is_compatible ("ti,am43" )) { + offset =0x630 ; + data->macid_sel_compat ="cpsw,am33xx" ; + }else if (of_machine_is_compatible ("ti,dra7" )) { + offset =0x514 ; + data->macid_sel_compat ="davinci,emac" ; + }else { +dev_err (dev,"incompatible machine/device type for reading mac address\n" ); +return -ENOENT ; + } syscon =fdtdec_lookup_phandle (fdt, node,"syscon" );if (syscon <0 ) {
@@ -73,49 +91,16 @@ static int cpsw_am33xx_cm_get_macid(struct udevice *dev, u16 offset, int slave,return -ENOENT ; } - addr = (u32 )map_physmem (fdt_translate_address (fdt, syscon, &gmii), -sizeof (u32),MAP_NOCACHE ); -if (addr ==FDT_ADDR_T_NONE ) { + data->syscon_addr = (u32 )map_physmem (fdt_translate_address (fdt, syscon, + &gmii), +sizeof (u32),MAP_NOCACHE ); +if (data->syscon_addr ==FDT_ADDR_T_NONE ) {pr_err ("Not able to get syscon address to get mac efuse address\n" );return -ENOENT ; } - addr +=CTRL_MAC_REG (offset, slave); - -/* try reading mac address from efuse */ - macid_lo =readl (addr); - macid_hi =readl (addr +4 ); - - mac_addr[5 ] = (macid_lo >>8 ) &0xff ; - mac_addr[4 ] = macid_lo &0xff ; - mac_addr[3 ] = (macid_hi >>24 ) &0xff ; - mac_addr[2 ] = (macid_hi >>16 ) &0xff ; - mac_addr[1 ] = (macid_hi >>8 ) &0xff ; - mac_addr[0 ] = macid_hi &0xff ; + data->syscon_addr +=CTRL_MAC_REG (offset, slave);return 0 ; -} - -int ti_cm_get_macid (struct udevice *dev,int slave,u8 *mac_addr) -{ -if (of_machine_is_compatible ("ti,dm8148" )) -return cpsw_am33xx_cm_get_macid (dev,0x630 , slave, mac_addr); - -if (of_machine_is_compatible ("ti,am33xx" )) -return cpsw_am33xx_cm_get_macid (dev,0x630 , slave, mac_addr); - -if (device_is_compatible (dev,"ti,am3517-emac" )) -return davinci_emac_3517_get_macid (dev,0x110 , slave, mac_addr); - -if (device_is_compatible (dev,"ti,dm816-emac" )) -return cpsw_am33xx_cm_get_macid (dev,0x30 , slave, mac_addr); - -if (of_machine_is_compatible ("ti,am43" )) -return cpsw_am33xx_cm_get_macid (dev,0x630 , slave, mac_addr); - -if (of_machine_is_compatible ("ti,dra7" )) -return davinci_emac_3517_get_macid (dev,0x514 , slave, mac_addr); -dev_err (dev,"incompatible machine/device type for reading mac address\n" ); -return -ENOENT ; }
drivers/net/ti/cpsw.c +2 -1
@@ -1185,6 +1185,7 @@ static int cpsw_eth_probe(struct udevice *dev) priv->dev = dev; priv->data = pdata->priv_pdata; +ti_cm_get_macid (dev, priv->data, pdata->enetaddr);/* Select phy interface in control module */ cpsw_phy_sel (priv, priv->data->phy_sel_compat, pdata->phy_interface);
@@ -1336,7 +1337,7 @@ static int cpsw_eth_ofdata_to_platdata(struct udevice *dev) data->slave_data[1 ].sliver_reg_ofs =CPSW_SLIVER1_OFFSET ; } - ret =ti_cm_get_macid (dev, active_slave, pdata->enetaddr); + ret =ti_cm_get_macid_addr (dev, active_slave, data);if (ret <0 ) {pr_err ("cpsw read efuse mac failed\n" );return ret;
include/cpsw.h +6 -1
@@ -51,10 +51,15 @@ struct cpsw_platform_data {bool rmii_clock_external;u8 version;const char *phy_sel_compat; +u32 syscon_addr; + const char *macid_sel_compat; };int cpsw_register (struct cpsw_platform_data *data); -int ti_cm_get_macid (struct udevice *dev,int slave,u8 *mac_addr); +int ti_cm_get_macid_addr (struct udevice *dev,int slave, +struct cpsw_platform_data *data); +void ti_cm_get_macid (struct udevice *dev,struct cpsw_platform_data *data, +u8 *mac_addr);int cpsw_get_slave_phy_addr (struct udevice *dev,int slave);#endif /* _CPSW_H_ */
Signature · 1 line
2.19.2
PATCH 4/11 net: ti: cpsw-common: Isolate getting syscon address from assigning macid
Quoted 9 lines · Faiz Abbas
ti_cm_get_macid()is used to get a syscon node from the dt, read the efuse address and then assign the macid read from the address. Divide these two steps into separate functions one of which can be called fromofdata_to_platdata()while the other can be called from_probe(). This ensures that platdata can be assigned statically in a board file whenOF_CONTROLis not enabled. Also add amacid_sel_compatin private data to get information about the macid byte placement.Signed-off-by Faiz Abbas <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190412/3524a1c1/attachment.sig>
PATCH 5/11 net: ti: cpsw: Block off ofdata_to_platdata with OF_CONTROL
In reply to Faiz AbbasThe ofdata_to_platdata function should not be called if OF_CONTROL is not enabled because fdtdec_* calls will fail. Block the function with OF_CONTROL
--- drivers/net/ti/cpsw.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
drivers/net/ti/cpsw.c +11 -7
@@ -1193,6 +1193,7 @@ static int cpsw_eth_probe(struct udevice *dev)return _cpsw_register (priv); } +#if CONFIG_IS_ENABLED (OF_CONTROL )static int cpsw_eth_ofdata_to_platdata (struct udevice *dev) {struct eth_pdata *pdata =dev_get_platdata (dev);
@@ -1352,6 +1353,13 @@ static int cpsw_eth_ofdata_to_platdata(struct udevice *dev) return 0; } +static const struct udevice_id cpsw_eth_ids[] = { + { .compatible ="ti,cpsw" }, + { .compatible ="ti,am335x-cpsw" }, + { } +}; +#endif +int cpsw_get_slave_phy_addr (struct udevice *dev,int slave) {struct cpsw_priv *priv =dev_get_priv (dev);
@@ -1360,21 +1368,17 @@ int cpsw_get_slave_phy_addr(struct udevice *dev, int slave)return data->slave_data[slave].phy_addr; } -static const struct udevice_id cpsw_eth_ids[] = { - { .compatible ="ti,cpsw" }, - { .compatible ="ti,am335x-cpsw" }, - { } -}; -U_BOOT_DRIVER (eth_cpsw) = { .name ="eth_cpsw" , .id =UCLASS_ETH , +#if CONFIG_IS_ENABLED(OF_CONTROL) .of_match = cpsw_eth_ids, .ofdata_to_platdata = cpsw_eth_ofdata_to_platdata, + .platdata_auto_alloc_size =sizeof (struct eth_pdata ), +#endif .probe = cpsw_eth_probe, .ops = &cpsw_eth_ops, .priv_auto_alloc_size =sizeof (struct cpsw_priv ), - .platdata_auto_alloc_size =sizeof (struct eth_pdata ), .flags =DM_FLAG_ALLOC_PRIV_DMA , };#endif /* CONFIG_DM_ETH */
Signature · 1 line
2.19.2
PATCH 5/11 net: ti: cpsw: Block off ofdata_to_platdata with OF_CONTROL
Quoted 5 lines · Faiz Abbas
The
ofdata_to_platdatafunction should not be called ifOF_CONTROLis not enabled because fdtdec_* calls will fail. Block the function withOF_CONTROLSigned-off-by Faiz Abbas <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190412/2cdf6a08/attachment.sig>
PATCH 6/11 net: ti: cpsw: Enable DM_FLAG_PRE_RELOC
In reply to Faiz AbbasAdd DM_FLAG_PRE_RELOC to make the driver probe in SPL.
--- drivers/net/ti/cpsw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ti/cpsw.c +1 -1
@@ -1379,6 +1379,6 @@ U_BOOT_DRIVER(eth_cpsw) = { .probe = cpsw_eth_probe, .ops = &cpsw_eth_ops, .priv_auto_alloc_size = sizeof(struct cpsw_priv), - .flags = DM_FLAG_ALLOC_PRIV_DMA, + .flags = DM_FLAG_ALLOC_PRIV_DMA | DM_FLAG_PRE_RELOC, };#endif /* CONFIG_DM_ETH */
Signature · 1 line
2.19.2
PATCH 6/11 net: ti: cpsw: Enable DM_FLAG_PRE_RELOC
Quoted 3 lines · Faiz Abbas
Add
DM_FLAG_PRE_RELOCto make the driver probe in SPL.Signed-off-by Faiz Abbas <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190412/66734d9a/attachment.sig>
PATCH 7/11 board: ti: am335x: Add platdata for cpsw in SPL
In reply to Faiz AbbasThe SPL image overflows when cpsw dt nodes are added and SPL_OF_CONTROL is enabled. Use static platdata instead to save space.
--- board/ti/am335x/board.c | 49 +++++++++++++++++++++++++++++++++++++++++ drivers/net/ti/cpsw.c | 18 --------------- include/cpsw.h | 17 ++++++++++++++ 3 files changed, 66 insertions(+), 18 deletions(-)
board/ti/am335x/board.c +49 -0
@@ -875,6 +875,55 @@ int board_late_init(void) }#endif +/* CPSW platdata */ +#if !CONFIG_IS_ENABLED (OF_CONTROL ) +struct cpsw_slave_data slave_data[] = { + { + .slave_reg_ofs =CPSW_SLAVE0_OFFSET , + .sliver_reg_ofs =CPSW_SLIVER0_OFFSET , + .phy_addr =0 , + }, + { + .slave_reg_ofs =CPSW_SLAVE1_OFFSET , + .sliver_reg_ofs =CPSW_SLIVER1_OFFSET , + .phy_addr =1 , + }, +}; + +struct cpsw_platform_data am335_eth_data = { + .cpsw_base =CPSW_BASE , + .version =CPSW_CTRL_VERSION_2 , + .bd_ram_ofs =CPSW_BD_OFFSET , + .ale_reg_ofs =CPSW_ALE_OFFSET , + .cpdma_reg_ofs =CPSW_CPDMA_OFFSET , + .mdio_div =CPSW_MDIO_DIV , + .host_port_reg_ofs =CPSW_HOST_PORT_OFFSET , + .channels =8 , + .slaves =2 , + .slave_data = slave_data, + .ale_entries =1024 , + .bd_ram_ofs =0x2000 , + .mac_control =0x20 , + .active_slave =0 , + .mdio_base =0x4a101000 , + .gmii_sel =0x44e10650 , + .phy_sel_compat ="ti,am3352-cpsw-phy-sel" , + .syscon_addr =0x44e10630 , + .macid_sel_compat ="cpsw,am33xx" , +}; + +struct eth_pdata cpsw_pdata = { + .iobase =0x4a100000 , + .phy_interface =0 , + .priv_pdata = &am335_eth_data, +}; + +U_BOOT_DEVICE (am335x_eth) = { + .name ="eth_cpsw" , + .platdata = &cpsw_pdata, +}; +#endif +#ifndef CONFIG_DM_ETH #if (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD)) || \
drivers/net/ti/cpsw.c +0 -18
@@ -33,24 +33,6 @@ DECLARE_GLOBAL_DATA_PTR;#define GIGABITEN BIT(7)#define FULLDUPLEXEN BIT(0)#define MIIEN BIT(15) - -/* reg offset */ -#define CPSW_HOST_PORT_OFFSET 0x108 -#define CPSW_SLAVE0_OFFSET 0x208 -#define CPSW_SLAVE1_OFFSET 0x308 -#define CPSW_SLAVE_SIZE 0x100 -#define CPSW_CPDMA_OFFSET 0x800 -#define CPSW_HW_STATS 0x900 -#define CPSW_STATERAM_OFFSET 0xa00 -#define CPSW_CPTS_OFFSET 0xc00 -#define CPSW_ALE_OFFSET 0xd00 -#define CPSW_SLIVER0_OFFSET 0xd80 -#define CPSW_SLIVER1_OFFSET 0xdc0 -#define CPSW_BD_OFFSET 0x2000 -#define CPSW_MDIO_DIV 0xff - -#define AM335X_GMII_SEL_OFFSET 0x630 -/* DMA Registers */ #define CPDMA_TXCONTROL 0x004#define CPDMA_RXCONTROL 0x014
include/cpsw.h +17 -0
@@ -16,6 +16,23 @@ #ifndef _CPSW_H_ #define _CPSW_H_ +/* reg offset */ +#define CPSW_HOST_PORT_OFFSET 0x108 +#define CPSW_SLAVE0_OFFSET 0x208 +#define CPSW_SLAVE1_OFFSET 0x308 +#define CPSW_SLAVE_SIZE 0x100 +#define CPSW_CPDMA_OFFSET 0x800 +#define CPSW_HW_STATS 0x900 +#define CPSW_STATERAM_OFFSET 0xa00 +#define CPSW_CPTS_OFFSET 0xc00 +#define CPSW_ALE_OFFSET 0xd00 +#define CPSW_SLIVER0_OFFSET 0xd80 +#define CPSW_SLIVER1_OFFSET 0xdc0 +#define CPSW_BD_OFFSET 0x2000 +#define CPSW_MDIO_DIV 0xff + +#define AM335X_GMII_SEL_OFFSET 0x630 + struct cpsw_slave_data { u32 slave_reg_ofs; u32 sliver_reg_ofs;
Signature · 1 line
2.19.2
PATCH 7/11 board: ti: am335x: Add platdata for cpsw in SPL
Quoted 4 lines · Faiz Abbas
The SPL image overflows when cpsw dt nodes are added and
SPL_OF_CONTROLis enabled. Use static platdata instead to save space.Signed-off-by Faiz Abbas <[email protected]>
We don't have SPL_OF_CONTROL enabled, yet, on am335x_evm. Do you have patches for that? My WIP on that gets hung up on USB support causing a crash early on and I've not worked out what I forgot to change for that. Thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190318/a68bb137/attachment.sig>
PATCH 7/11 board: ti: am335x: Add platdata for cpsw in SPL
Hi Tom,
Quoted 5 lines · Tom Rini
Quoted 3 lines · Faiz Abbas
The SPL image overflows when cpsw dt nodes are added and
SPL_OF_CONTROLis enabled. Use static platdata instead to save space.
Quoted 7 lines
Quoted 1 line
Signed-off-by Faiz Abbas <[email protected]>We don't have
SPL_OF_CONTROLenabled, yet, onam335x_evm. Do you have patches for that? My WIP on that gets hung up on USB support causing a crash early on and I've not worked out what I forgot to change for that. Thanks!
The series doesn't intend to enable SPL_OF_CONTROL. It circumvents the requirement by adding static platdata.
Thanks,
Faiz
PATCH 7/11 board: ti: am335x: Add platdata for cpsw in SPL
In reply to Faiz AbbasQuoted 4 lines · Faiz Abbas
The SPL image overflows when cpsw dt nodes are added and
SPL_OF_CONTROLis enabled. Use static platdata instead to save space.Signed-off-by Faiz Abbas <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190412/85982483/attachment.sig>
PATCH 8/11 configs: am335x_evm: Reduce size of SPL
In reply to Faiz AbbasMake some room in SPL by getting rid of unnecessary configs.
--- configs/am335x_evm_defconfig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
configs/am335x_evm_defconfig +4 -1
@@ -7,6 +7,7 @@ CONFIG_DISTRO_DEFAULTS=y CONFIG_SPL_LOAD_FIT=y CONFIG_OF_BOARD_SETUP=y CONFIG_BOOTCOMMAND="if test ${boot_fit} -eq 1; then run update_to_fit; fi; run findfdt; run init_console; run envboot; run distro_bootcmd" +CONFIG_LOGLEVEL=3 CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_VERSION_VARIABLE=y CONFIG_ARCH_MISC_INIT=y
@@ -31,6 +32,7 @@ CONFIG_OF_CONTROL=y CONFIG_DEFAULT_DEVICE_TREE="am335x-evm" CONFIG_OF_LIST="am335x-evm am335x-bone am335x-boneblack am335x-evmsk am335x-bonegreen am335x-icev2" CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y +CONFIG_SPL_ENV_IS_NOWHERE=y CONFIG_BOOTCOUNT_LIMIT=y CONFIG_DFU_MMC=y CONFIG_DFU_NAND=y
@@ -39,13 +41,13 @@ CONFIG_USB_FUNCTION_FASTBOOT=y CONFIG_DM_I2C=y CONFIG_MISC=y CONFIG_DM_MMC=y +# CONFIG_MMC_HW_PARTITIONING is not set CONFIG_MMC_OMAP_HS=y CONFIG_NAND=y CONFIG_DM_SPI_FLASH=y CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_WINBOND=y CONFIG_DM_ETH=y -CONFIG_PHY_GIGE=y CONFIG_MII=y CONFIG_DRIVER_TI_CPSW=y CONFIG_SPI=y
@@ -69,3 +71,4 @@ CONFIG_USB_ETHER=y CONFIG_DYNAMIC_CRC_TABLE=y CONFIG_RSA=y CONFIG_LZO=y +# CONFIG_OF_LIBFDT_OVERLAY is not set
Signature · 1 line
2.19.2
PATCH 8/11 configs: am335x_evm: Reduce size of SPL
Quoted 1 line · Faiz Abbas
Make some room in SPL by getting rid of unnecessary configs.
I'm not sure about some of these.
configs/am335x_evm_defconfig CONFIG_OF_CONTROL=y · line 38
Quoted 8 lines
configs/am335x_evm_defconfig +1
-0@@ -31,6 +32,7 @@ CONFIG_OF_CONTROL=y CONFIG_DEFAULT_DEVICE_TREE="am335x-evm" CONFIG_OF_LIST="am335x-evm am335x-bone am335x-boneblack am335x-evmsk am335x-bonegreen am335x-icev2" CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y +CONFIG_SPL_ENV_IS_NOWHERE=y CONFIG_BOOTCOUNT_LIMIT=y CONFIG_DFU_MMC=y CONFIG_DFU_NAND=y
This breaks disabling falcon mode from the env.
[snip]
configs/am335x_evm_defconfig CONFIG_USB_ETHER=y · line 74
Quoted 5 lines
configs/am335x_evm_defconfig +1
-0@@ -69,3 +71,4 @@ CONFIG_USB_ETHER=y CONFIG_DYNAMIC_CRC_TABLE=y CONFIG_RSA=y CONFIG_LZO=y +# CONFIG_OF_LIBFDT_OVERLAY is not set
This is removing the overlay support from the main U-Boot binary, not SPL. And we don't want to do that since that removes applying overlays for capes on Beaglebones.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190318/0a9e6034/attachment.sig>
PATCH 8/11 configs: am335x_evm: Reduce size of SPL
In reply to Faiz AbbasQuoted 3 lines · Faiz Abbas
Make some room in SPL by getting rid of unnecessary configs.
Signed-off-by Faiz Abbas <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190412/4905e1d3/attachment.sig>
PATCH 9/11 configs: am335x_evm: Add Support for SPL_ETH
In reply to Faiz AbbasAdd Support for booting from Ethernet.
--- configs/am335x_evm_defconfig | 1 + 1 file changed, 1 insertion(+)
configs/am335x_evm_defconfig +1 -0
@@ -11,6 +11,7 @@ CONFIG_LOGLEVEL=3 CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_VERSION_VARIABLE=y CONFIG_ARCH_MISC_INIT=y +CONFIG_SPL_ETH_SUPPORT=y # CONFIG_SPL_FS_EXT4 is not set CONFIG_SPL_MTD_SUPPORT=y CONFIG_SPL_MUSB_NEW_SUPPORT=y
Signature · 1 line
2.19.2
PATCH 9/11 configs: am335x_evm: Add Support for SPL_ETH
Quoted 3 lines · Faiz Abbas
Add Support for booting from Ethernet.
Signed-off-by Faiz Abbas <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190412/5899e43c/attachment.sig>
PATCH 10/11 configs: am335x_evm: Update VCI String
In reply to Faiz AbbasUpdate VCI string to keep it compatible with legacy test setups.
--- configs/am335x_evm_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
configs/am335x_evm_defconfig +1 -1
@@ -16,7 +16,7 @@ CONFIG_SPL_ETH_SUPPORT=y CONFIG_SPL_MTD_SUPPORT=y CONFIG_SPL_MUSB_NEW_SUPPORT=y CONFIG_SPL_NET_SUPPORT=y -CONFIG_SPL_NET_VCI_STRING="AM33xx U-Boot SPL" +CONFIG_SPL_NET_VCI_STRING="AM335x U-Boot SPL" CONFIG_SPL_OS_BOOT=y CONFIG_SPL_USB_GADGET=y CONFIG_SPL_USB_ETHER=y
Signature · 1 line
2.19.2
PATCH 10/11 configs: am335x_evm: Update VCI String
Quoted 3 lines · Faiz Abbas
Update VCI string to keep it compatible with legacy test setups.
Signed-off-by Faiz Abbas <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190318/ba02a540/attachment.sig>
PATCH 10/11 configs: am335x_evm: Update VCI String
In reply to Faiz AbbasQuoted 4 lines · Faiz Abbas
Update VCI string to keep it compatible with legacy test setups.
Signed-off-by Faiz Abbas <[email protected]>Reviewed-by Tom Rini <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190412/9de807ba/attachment.sig>
PATCH 11/11 board: ti: am335x: Remove non DM_ETH code
In reply to Faiz AbbasWith DM_ETH enabled in am335x devices, remove all the unused non-DM code.
--- board/ti/am335x/board.c | 151 ---------------------------------------- 1 file changed, 151 deletions(-)
board/ti/am335x/board.c +0 -151
@@ -924,157 +924,6 @@ U_BOOT_DEVICE(am335x_eth) = { };#endif -#ifndef CONFIG_DM_ETH - -#if (defined(CONFIG_DRIVER_TI_CPSW ) && !defined(CONFIG_SPL_BUILD )) || \ - (defined(CONFIG_SPL_ETH_SUPPORT ) && defined(CONFIG_SPL_BUILD )) -static void cpsw_control (int enabled) -{ -/* VTP can be added here */ - -return ; -} - -static struct cpsw_slave_data cpsw_slaves[] = { - { - .slave_reg_ofs =0x208 , - .sliver_reg_ofs =0xd80 , - .phy_addr =0 , - }, - { - .slave_reg_ofs =0x308 , - .sliver_reg_ofs =0xdc0 , - .phy_addr =1 , - }, -}; - -static struct cpsw_platform_data cpsw_data = { - .mdio_base =CPSW_MDIO_BASE , - .cpsw_base =CPSW_BASE , - .mdio_div =0xff , - .channels =8 , - .cpdma_reg_ofs =0x800 , - .slaves =1 , - .slave_data = cpsw_slaves, - .ale_reg_ofs =0xd00 , - .ale_entries =1024 , - .host_port_reg_ofs =0x108 , - .hw_stats_reg_ofs =0x900 , - .bd_ram_ofs =0x2000 , - .mac_control = (1 <<5 ), - .control = cpsw_control, - .host_port_num =0 , - .version =CPSW_CTRL_VERSION_2 , -}; -#endif - -#if ((defined(CONFIG_SPL_ETH_SUPPORT ) || defined(CONFIG_SPL_USB_ETHER )) &&\ - defined(CONFIG_SPL_BUILD )) || \ - ((defined(CONFIG_DRIVER_TI_CPSW ) || \ - defined(CONFIG_USB_ETHER ) && defined(CONFIG_MUSB_GADGET )) && \ - !defined(CONFIG_SPL_BUILD )) - -/* -* This function will: -* Read the eFuse for MAC addresses, and set ethaddr/eth1addr/usbnet_devaddr -* in the environment -* Perform fixups to the PHY present on certain boards. We only need this -* function in: -* - SPL with either CPSW or USB ethernet support -* - Full U-Boot, with either CPSW or USB ethernet -* Build in only these cases to avoid warnings about unused variables -* when we build an SPL that has neither option but full U-Boot will. -*/ -int board_eth_init (bd_t *bis) -{ -int rv, n =0 ; -#if defined(CONFIG_USB_ETHER ) && \ - (!defined(CONFIG_SPL_BUILD ) || defined(CONFIG_SPL_USB_ETHER )) -uint8_t mac_addr[6 ]; -uint32_t mac_hi, mac_lo; - -/* -* use efuse mac address for USB ethernet as we know that -* both CPSW and USB ethernet will never be active@the same time -*/ - mac_lo =readl (&cdev->macid0l); - mac_hi =readl (&cdev->macid0h); - mac_addr[0 ] = mac_hi &0xFF ; - mac_addr[1 ] = (mac_hi &0xFF00 ) >>8 ; - mac_addr[2 ] = (mac_hi &0xFF0000 ) >>16 ; - mac_addr[3 ] = (mac_hi &0xFF000000 ) >>24 ; - mac_addr[4 ] = mac_lo &0xFF ; - mac_addr[5 ] = (mac_lo &0xFF00 ) >>8 ; -#endif - - -#if (defined(CONFIG_DRIVER_TI_CPSW ) && !defined(CONFIG_SPL_BUILD )) || \ - (defined(CONFIG_SPL_ETH_SUPPORT ) && defined(CONFIG_SPL_BUILD )) - -#ifdef CONFIG_DRIVER_TI_CPSW -if (board_is_bone () ||board_is_bone_lt () ||board_is_bben () || -board_is_idk ()) { -writel (MII_MODE_ENABLE , &cdev->miisel); - cpsw_slaves[0 ].phy_if = cpsw_slaves[1 ].phy_if = -PHY_INTERFACE_MODE_MII ; - }else if (board_is_icev2 ()) { -writel (RMII_MODE_ENABLE |RMII_CHIPCKL_ENABLE , &cdev->miisel); - cpsw_slaves[0 ].phy_if =PHY_INTERFACE_MODE_RMII ; - cpsw_slaves[1 ].phy_if =PHY_INTERFACE_MODE_RMII ; - cpsw_slaves[0 ].phy_addr =1 ; - cpsw_slaves[1 ].phy_addr =3 ; - }else { -writel ((RGMII_MODE_ENABLE |RGMII_INT_DELAY ), &cdev->miisel); - cpsw_slaves[0 ].phy_if = cpsw_slaves[1 ].phy_if = -PHY_INTERFACE_MODE_RGMII ; - } - - rv =cpsw_register (&cpsw_data); -if (rv <0 ) -printf ("Error %d registering CPSW switch\n" , rv); -else - n += rv; -#endif - -/* -* -* CPSW RGMII Internal Delay Mode is not supported in all PVT -* operating points. So we must set the TX clock delay feature -* in the AR8051 PHY. Since we only support a single ethernet -* device in U-Boot, we only do this for the first instance. -*/ -#define AR8051_PHY_DEBUG_ADDR_REG 0x1d -#define AR8051_PHY_DEBUG_DATA_REG 0x1e -#define AR8051_DEBUG_RGMII_CLK_DLY_REG 0x5 -#define AR8051_RGMII_TX_CLK_DLY 0x100 - -if (board_is_evm_sk () ||board_is_gp_evm () ||board_is_bben ()) { -const char *devname; - devname =miiphy_get_current_dev (); - -miiphy_write (devname,0x0 ,AR8051_PHY_DEBUG_ADDR_REG , -AR8051_DEBUG_RGMII_CLK_DLY_REG ); -miiphy_write (devname,0x0 ,AR8051_PHY_DEBUG_DATA_REG , -AR8051_RGMII_TX_CLK_DLY ); - } -#endif -#if defined(CONFIG_USB_ETHER ) && \ - (!defined(CONFIG_SPL_BUILD ) || defined(CONFIG_SPL_USB_ETHER )) -if (is_valid_ethaddr (mac_addr)) -eth_env_set_enetaddr ("usbnet_devaddr" , mac_addr); - - rv =usb_eth_initialize (bis); -if (rv <0 ) -printf ("Error %d registering USB_ETHER\n" , rv); -else - n += rv; -#endif -return n; -} -#endif - -#endif /* CONFIG_DM_ETH */ -#ifdef CONFIG_SPL_LOAD_FIT int board_fit_config_name_match (const char *name) {
Signature · 1 line
2.19.2
PATCH 11/11 board: ti: am335x: Remove non DM_ETH code
Quoted 4 lines · Faiz Abbas
With
DM_ETHenabled in am335x devices, remove all the unused non-DM code.Signed-off-by Faiz Abbas <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190412/d8778dff/attachment.sig>
cover Fix Ethernet boot in am335x
In reply to Faiz AbbasQuoted 5 lines · Faiz Abbas
The following patches fix ethernet boot in am335x.
Enabling
OF_CONTROLin SPL makes it overflow the sram size. To avoid this, I am using static platdata in the am335x board file instead of the fdtdec_*() calls used inofdata_to_platdata().
What hardware are you testing this on? While I think this worked on my EVM at some point in the past, I also thought it wasn't supported due to board design issues. Thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190318/495074cd/attachment.sig>
cover Fix Ethernet boot in am335x
Hi Tom,
Quoted 4 lines · Tom Rini
Quoted 2 lines · Faiz Abbas
The following patches fix ethernet boot in am335x.
Quoted 8 lines
Quoted 3 lines
Enabling
OF_CONTROLin SPL makes it overflow the sram size. To avoid this, I am using static platdata in the am335x board file instead of the fdtdec_*() calls used inofdata_to_platdata().What hardware are you testing this on? While I think this worked on my EVM at some point in the past, I also thought it wasn't supported due to board design issues. Thanks!
You are correct. The evm doesn't support boot because of incompatibility with the phy.
I used a beaglebone black with modified bootpins.
Thanks,
Faiz
cover Fix Ethernet boot in am335x
In reply to Faiz AbbasQuoted 3 lines · Faiz Abbas
The following patches fix ethernet boot in am335x.
Enabling
OF_CONTROLin SPL makes it overflow the sram size. To avoid
If you are overflowing SRAM on the non-HS devices you are even more constrained on HS, you don't need an HS to test, just build for am335x_hs_evm_defconfig and it should break build if you out of space.
Thanks,
Andrew
Quoted 37 lines
this, I am using static platdata in the am335x board file instead of the fdtdec_*() calls used in
ofdata_to_platdata().Patches 1-5 isolate the two operations of getting platform data (all of which should happen in
_ofdata_to_platdata()) and initial configurations (all of which should happen in_probe()).Patch 6 makes sure the cpsw driver gets probed in SPL. Patch 7 adds static platdata to the am335 board file. Patches 8-10 makes changes in the config to make space for and enable
ETH_SUPPORTin SPL.
Patch 11 removes non-DM_ETH code from the am335x board file.Tested ethernet boot and tftp in am335x-evm. Regression tested on dra71x-evm.
Faiz Abbas (11):
net: Addpriv_pdatatoeth_pdata
net: ti: cpsw: Movecpsw_phy_sel()to_probe()
net: ti: cpsw: Convertcpsw_platform_datato a pointer incpsw_priv
net: ti: cpsw-common: Isolate getting syscon address from assigning
macid
net: ti: cpsw: Block offofdata_to_platdatawithOF_CONTROL
net: ti: cpsw: EnableDM_FLAG_PRE_RELOC
board: ti: am335x: Add platdata for cpsw in SPL
configs:am335x_evm: Reduce size of SPL
configs:am335x_evm: Add Support forSPL_ETH
configs:am335x_evm: Update VCI String
board: ti: am335x: Remove nonDM_ETHcodeboard/ti/am335x/board.c | 170 ++++++----------------------- configs/am335x_evm_defconfig | 8 +- drivers/net/ti/cpsw-common.c | 127 ++++++++++------------ drivers/net/ti/cpsw.c | 202 ++++++++++++++++------------------- include/cpsw.h | 25 ++++- include/net.h | 2 + 6 files changed, 217 insertions(+), 317 deletions(-)
cover Fix Ethernet boot in am335x
Quoted 9 lines · Andrew F. Davis
Quoted 3 lines · Faiz Abbas
The following patches fix ethernet boot in am335x.
Enabling
OF_CONTROLin SPL makes it overflow the sram size. To avoidIf you are overflowing SRAM on the non-HS devices you are even more constrained on HS, you don't need an HS to test, just build for
am335x_hs_evm_defconfigand it should break build if you out of space.
Oh, and if build complains about not having SECDEV tools use this:
https://github.com/glneo/dummy-secdev
Andrew
Quoted 45 lines
Thanks,
AndrewQuoted 29 lines
this, I am using static platdata in the am335x board file instead of the fdtdec_*() calls used in
ofdata_to_platdata().Patches 1-5 isolate the two operations of getting platform data (all of which should happen in
_ofdata_to_platdata()) and initial configurations (all of which should happen in_probe()).Patch 6 makes sure the cpsw driver gets probed in SPL. Patch 7 adds static platdata to the am335 board file. Patches 8-10 makes changes in the config to make space for and enable
ETH_SUPPORTin SPL.
Patch 11 removes non-DM_ETH code from the am335x board file.Tested ethernet boot and tftp in am335x-evm. Regression tested on dra71x-evm.
Faiz Abbas (11):
net: Addpriv_pdatatoeth_pdata
net: ti: cpsw: Movecpsw_phy_sel()to_probe()
net: ti: cpsw: Convertcpsw_platform_datato a pointer incpsw_priv
net: ti: cpsw-common: Isolate getting syscon address from assigning
macid
net: ti: cpsw: Block offofdata_to_platdatawithOF_CONTROL
net: ti: cpsw: EnableDM_FLAG_PRE_RELOC
board: ti: am335x: Add platdata for cpsw in SPL
configs:am335x_evm: Reduce size of SPL
configs:am335x_evm: Add Support forSPL_ETH
configs:am335x_evm: Update VCI String
board: ti: am335x: Remove nonDM_ETHcodeQuoted 8 lines
board/ti/am335x/board.c | 170 ++++++----------------------- configs/am335x_evm_defconfig | 8 +- drivers/net/ti/cpsw-common.c | 127 ++++++++++------------ drivers/net/ti/cpsw.c | 202 ++++++++++++++++------------------- include/cpsw.h | 25 ++++- include/net.h | 2 + 6 files changed, 217 insertions(+), 317 deletions(-)_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot